diff options
author | Jeff Donahue <jeff.donahue@gmail.com> | 2014-06-16 16:37:17 -0700 |
---|---|---|
committer | Evan Shelhamer <shelhamer@imaginarynumber.net> | 2014-06-26 12:07:39 -0700 |
commit | a04834f6ceee13310b7f4e17ccf639c1e7abd459 (patch) | |
tree | bdd42194e955373c5d37e461849ba8b8b29a917a /include/caffe/layer.hpp | |
parent | 74443591d62feb2755d98ed87fb4aecc22d78297 (diff) | |
download | caffeonacl-a04834f6ceee13310b7f4e17ccf639c1e7abd459.tar.gz caffeonacl-a04834f6ceee13310b7f4e17ccf639c1e7abd459.tar.bz2 caffeonacl-a04834f6ceee13310b7f4e17ccf639c1e7abd459.zip |
force_backward works properly with non-backproppable things
Diffstat (limited to 'include/caffe/layer.hpp')
-rw-r--r-- | include/caffe/layer.hpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/include/caffe/layer.hpp b/include/caffe/layer.hpp index 12e7610d..690c36ba 100644 --- a/include/caffe/layer.hpp +++ b/include/caffe/layer.hpp @@ -84,6 +84,14 @@ class Layer { virtual inline int MinTopBlobs() const { return -1; } virtual inline int MaxTopBlobs() const { return -1; } + // Declare for each bottom blob whether to allow force_backward -- that is, + // if AllowForceBackward(i) == false, we will ignore the force_backward + // setting and backpropagate to blob i only if it needs gradient information + // (as is done when force_backward == false). + virtual inline bool AllowForceBackward(const int bottom_index) const { + return true; + } + protected: // The protobuf that stores the layer parameters LayerParameter layer_param_; |