Make comments for sparse GaussianFiller match actual behavior
authorJeff Donahue <jeff.donahue@gmail.com>
Sat, 17 Jan 2015 23:41:44 +0000 (15:41 -0800)
committerJeff Donahue <jeff.donahue@gmail.com>
Sat, 17 Jan 2015 23:43:38 +0000 (15:43 -0800)
(Fixes #1497 reported by @denizyuret)

include/caffe/filler.hpp
src/caffe/proto/caffe.proto

index 136ce95..eebf565 100644 (file)
@@ -76,13 +76,13 @@ class GaussianFiller : public Filler<Dtype> {
     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<int*>(rand_vec_->mutable_cpu_data());
       caffe_rng_bernoulli(blob->count(), non_zero_probability, mask);
index 8086ad6..d6eec02 100644 (file)
@@ -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];
 }