From 66b21db6ed4b93bdd81a4dc828526fe961e5a9cc Mon Sep 17 00:00:00 2001 From: chavicoski Date: Tue, 25 May 2021 16:58:05 +0200 Subject: [PATCH 1/2] Fixed GlobalMaxPool1D bug --- src/apis/eddl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/apis/eddl.cpp b/src/apis/eddl.cpp index 6f345d266..5803219f0 100644 --- a/src/apis/eddl.cpp +++ b/src/apis/eddl.cpp @@ -1157,7 +1157,7 @@ namespace eddl { int h=parent->output->shape[2]; if (name.empty()) { name = "GlobalMaxPool1D"; } // Set default name - return MaxPool1D(parent, {h},{1}, name); + return MaxPool1D(parent, {h}, {1}, "none", name); } layer GlobalMaxPool2D(layer parent, string name){ From 2bb241a1b4a308007b72293ccaab62bac1cb3633 Mon Sep 17 00:00:00 2001 From: chavicoski Date: Tue, 25 May 2021 17:43:42 +0200 Subject: [PATCH 2/2] Fixed Norm, NormMax and NormMinMax bug --- src/layers/normalization/layer_norm.cpp | 6 +++--- src/layers/normalization/layer_normmax.cpp | 6 +++--- src/layers/normalization/layer_normminmax.cpp | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/layers/normalization/layer_norm.cpp b/src/layers/normalization/layer_norm.cpp index ff3b7f797..ee6ba5c90 100644 --- a/src/layers/normalization/layer_norm.cpp +++ b/src/layers/normalization/layer_norm.cpp @@ -24,9 +24,9 @@ int LNorm::total_layers = 0; LNorm::LNorm(Layer *parent, float epsilon, string name, int dev, int mem) : LinLayer(name, dev, mem) { - vector axis; - if (parent->output->ndim == 2) axis.push_back(1); - else if (parent->output->ndim == 4) {axis.push_back(1);axis.push_back(2);axis.push_back(3);} + vector axis; // To store the axis to reduce (starting from the next dimension of the batch) + if (parent->output->ndim == 2) axis.push_back(0); + else if (parent->output->ndim == 4) {axis.push_back(0);axis.push_back(1);axis.push_back(2);} else msg("LNorm only works over 2D or 4D tensors", "LNorm"); if(name.empty()) this->name = "norm" + to_string(++total_layers); diff --git a/src/layers/normalization/layer_normmax.cpp b/src/layers/normalization/layer_normmax.cpp index 958789444..cece5c844 100644 --- a/src/layers/normalization/layer_normmax.cpp +++ b/src/layers/normalization/layer_normmax.cpp @@ -23,9 +23,9 @@ int LNormMax::total_layers = 0; LNormMax::LNormMax(Layer *parent, float epsilon, string name, int dev, int mem) : LinLayer(name, dev, mem) { - vector axis; - if (parent->output->ndim == 2) axis.push_back(1); - else if (parent->output->ndim == 4) {axis.push_back(1);axis.push_back(2);axis.push_back(3);} + vector axis; // To store the axis to reduce (starting from the next dimension of the batch) + if (parent->output->ndim == 2) axis.push_back(0); + else if (parent->output->ndim == 4) {axis.push_back(0);axis.push_back(1);axis.push_back(2);} else msg("LNormMax only works over 2D or 4D tensors", "LNormMax"); if(name.empty()) this->name = "normmax" + to_string(++total_layers); diff --git a/src/layers/normalization/layer_normminmax.cpp b/src/layers/normalization/layer_normminmax.cpp index 4d6ac8f98..f84ed06c4 100644 --- a/src/layers/normalization/layer_normminmax.cpp +++ b/src/layers/normalization/layer_normminmax.cpp @@ -23,9 +23,9 @@ int LNormMinMax::total_layers = 0; LNormMinMax::LNormMinMax(Layer *parent, float epsilon, string name, int dev, int mem) : LinLayer(name, dev, mem) { - vector axis; - if (parent->output->ndim == 2) axis.push_back(1); - else if (parent->output->ndim == 4) {axis.push_back(1);axis.push_back(2);axis.push_back(3);} + vector axis; // To store the axis to reduce (starting from the next dimension of the batch) + if (parent->output->ndim == 2) axis.push_back(0); + else if (parent->output->ndim == 4) {axis.push_back(0);axis.push_back(1);axis.push_back(2);} else msg("LNormMinMax only works over 2D or 4D tensors", "LNormMinMax"); if(name.empty()) this->name = "normminmax" + to_string(++total_layers);