From d3ebf3e5b1c721770df51ae99e9bb4de8ef9b2b1 Mon Sep 17 00:00:00 2001 From: Jeff Donahue Date: Thu, 26 Mar 2015 00:56:31 -0700 Subject: [PATCH] RecurrentLayer bugfix: params still need backprop --- src/caffe/layers/recurrent_layer.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/caffe/layers/recurrent_layer.cpp b/src/caffe/layers/recurrent_layer.cpp index 7dc38fec901..13f66f9893e 100644 --- a/src/caffe/layers/recurrent_layer.cpp +++ b/src/caffe/layers/recurrent_layer.cpp @@ -208,8 +208,12 @@ template void RecurrentLayer::Backward_cpu(const vector*>& top, const vector& propagate_down, const vector*>& bottom) { CHECK(!propagate_down[1]) << "Cannot backpropagate to sequence indicators."; - if (!propagate_down[0] && !propagate_down[2]) { return; } + // TODO: skip backpropagation to inputs and parameters inside the unrolled + // net according to propagate_down[0] and propagate_down[2]. For now just + // backprop to inputs and parameters unconditionally, as either the inputs or + // the parameters do need backward (or Net would have set + // layer_needs_backward_[i] == false for this layer). unrolled_net_->Backward(); }