From 18b01ad6d6fcfc756be2aadfd4fd6e84f938870c Mon Sep 17 00:00:00 2001 From: Noiredd Date: Tue, 27 Jun 2017 15:04:52 +0200 Subject: [PATCH 1/2] Fixed bilinear filler --- include/caffe/filler.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/caffe/filler.hpp b/include/caffe/filler.hpp index dad9ad46b3b..8eb33d5f440 100644 --- a/include/caffe/filler.hpp +++ b/include/caffe/filler.hpp @@ -250,7 +250,7 @@ class BilinearFiller : public Filler { CHECK_EQ(blob->width(), blob->height()) << "Filter must be square"; Dtype* data = blob->mutable_cpu_data(); int f = ceil(blob->width() / 2.); - float c = (2 * f - 1 - f % 2) / (2. * f); + float c = fabs(blob->width() - 1) / (2. * f); for (int i = 0; i < blob->count(); ++i) { float x = i % blob->width(); float y = (i / blob->width()) % blob->height(); From 2e0a371d7851b07efc0e0c178b69eb269f4859b5 Mon Sep 17 00:00:00 2001 From: Noiredd Date: Wed, 28 Jun 2017 10:40:55 +0200 Subject: [PATCH 2/2] Cleanup --- include/caffe/filler.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/caffe/filler.hpp b/include/caffe/filler.hpp index 8eb33d5f440..515ebbbaa35 100644 --- a/include/caffe/filler.hpp +++ b/include/caffe/filler.hpp @@ -250,7 +250,7 @@ class BilinearFiller : public Filler { CHECK_EQ(blob->width(), blob->height()) << "Filter must be square"; Dtype* data = blob->mutable_cpu_data(); int f = ceil(blob->width() / 2.); - float c = fabs(blob->width() - 1) / (2. * f); + float c = (blob->width() - 1) / (2. * f); for (int i = 0; i < blob->count(); ++i) { float x = i % blob->width(); float y = (i / blob->width()) % blob->height();