diff --git a/include/caffe/filler.hpp b/include/caffe/filler.hpp index dad9ad46b3b..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 = (2 * f - 1 - f % 2) / (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();