MCPcopy Create free account
hub / github.com/OpenPTrack/open_ptrack_v2 / Forward_cpu

Method Forward_cpu

rtpose_wrapper/src/caffe/layers/recurrent_layer.cpp:245–274  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

243
244template <typename Dtype>
245void RecurrentLayer<Dtype>::Forward_cpu(const vector<Blob<Dtype>*>& bottom,
246 const vector<Blob<Dtype>*>& top) {
247 // Hacky fix for test time: reshare all the internal shared blobs, which may
248 // currently point to a stale owner blob that was dropped when Solver::Test
249 // called test_net->ShareTrainedLayersWith(net_.get()).
250 // TODO: somehow make this work non-hackily.
251 if (this->phase_ == TEST) {
252 unrolled_net_->ShareWeights();
253 }
254
255 DCHECK_EQ(recur_input_blobs_.size(), recur_output_blobs_.size());
256 if (!expose_hidden_) {
257 for (int i = 0; i < recur_input_blobs_.size(); ++i) {
258 const int count = recur_input_blobs_[i]->count();
259 DCHECK_EQ(count, recur_output_blobs_[i]->count());
260 const Dtype* timestep_T_data = recur_output_blobs_[i]->cpu_data();
261 Dtype* timestep_0_data = recur_input_blobs_[i]->mutable_cpu_data();
262 caffe_copy(count, timestep_T_data, timestep_0_data);
263 }
264 }
265
266 unrolled_net_->ForwardTo(last_layer_index_);
267
268 if (expose_hidden_) {
269 const int top_offset = output_blobs_.size();
270 for (int i = top_offset, j = 0; i < top.size(); ++i, ++j) {
271 top[i]->ShareData(*recur_output_blobs_[j]);
272 }
273 }
274}
275
276template <typename Dtype>
277void RecurrentLayer<Dtype>::Backward_cpu(const vector<Blob<Dtype>*>& top,

Callers

nothing calls this directly

Calls 8

caffe_copyFunction · 0.85
ShareWeightsMethod · 0.80
countMethod · 0.80
ForwardToMethod · 0.80
ShareDataMethod · 0.80
sizeMethod · 0.45
cpu_dataMethod · 0.45
mutable_cpu_dataMethod · 0.45

Tested by

no test coverage detected