From 1304173d85d3d382d3ae2b2aa4f6c04b2c8c75ca Mon Sep 17 00:00:00 2001 From: Jeff Donahue Date: Sat, 17 Jan 2015 15:41:44 -0800 Subject: [PATCH] Make comments for sparse GaussianFiller match actual behavior (Fixes #1497 reported by @denizyuret) --- include/caffe/filler.hpp | 6 +++--- src/caffe/proto/caffe.proto | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/caffe/filler.hpp b/include/caffe/filler.hpp index 136ce95..eebf565 100644 --- a/include/caffe/filler.hpp +++ b/include/caffe/filler.hpp @@ -76,13 +76,13 @@ class GaussianFiller : public Filler { CHECK_GE(sparse, -1); if (sparse >= 0) { // Sparse initialization is implemented for "weight" blobs; i.e. matrices. - // These have num == channels == 1; height is number of inputs; width is + // These have num == channels == 1; width is number of inputs; height is // number of outputs. The 'sparse' variable specifies the mean number // of non-zero input weights for a given output. CHECK_EQ(blob->num(), 1); CHECK_EQ(blob->channels(), 1); - int num_inputs = blob->height(); - Dtype non_zero_probability = Dtype(sparse) / Dtype(num_inputs); + int num_outputs = blob->height(); + Dtype non_zero_probability = Dtype(sparse) / Dtype(num_outputs); rand_vec_.reset(new SyncedMemory(blob->count() * sizeof(int))); int* mask = reinterpret_cast(rand_vec_->mutable_cpu_data()); caffe_rng_bernoulli(blob->count(), non_zero_probability, mask); diff --git a/src/caffe/proto/caffe.proto b/src/caffe/proto/caffe.proto index 8086ad6..d6eec02 100644 --- a/src/caffe/proto/caffe.proto +++ b/src/caffe/proto/caffe.proto @@ -38,7 +38,7 @@ message FillerParameter { optional float max = 4 [default = 1]; // the max value in uniform filler optional float mean = 5 [default = 0]; // the mean value in Gaussian filler optional float std = 6 [default = 1]; // the std value in Gaussian filler - // The expected number of non-zero input weights for a given output in + // The expected number of non-zero output weights for a given input in // Gaussian filler -- the default -1 means don't perform sparsification. optional int32 sparse = 7 [default = -1]; } -- 2.7.4