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

Method Forward

rtpose_wrapper/include/caffe/layer.hpp:451–487  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

449// functions.
450template <typename Dtype>
451inline Dtype Layer<Dtype>::Forward(const vector<Blob<Dtype>*>& bottom,
452 const vector<Blob<Dtype>*>& top) {
453 // Lock during forward to ensure sequential forward
454 Lock();
455 Dtype loss = 0;
456 Reshape(bottom, top);
457 switch (Caffe::mode()) {
458 case Caffe::CPU:
459 Forward_cpu(bottom, top);
460 for (int top_id = 0; top_id < top.size(); ++top_id) {
461 if (!this->loss(top_id)) { continue; }
462 const int count = top[top_id]->count();
463 const Dtype* data = top[top_id]->cpu_data();
464 const Dtype* loss_weights = top[top_id]->cpu_diff();
465 loss += caffe_cpu_dot(count, data, loss_weights);
466 }
467 break;
468 case Caffe::GPU:
469 Forward_gpu(bottom, top);
470#ifndef CPU_ONLY
471 for (int top_id = 0; top_id < top.size(); ++top_id) {
472 if (!this->loss(top_id)) { continue; }
473 const int count = top[top_id]->count();
474 const Dtype* data = top[top_id]->gpu_data();
475 const Dtype* loss_weights = top[top_id]->gpu_diff();
476 Dtype blob_loss = 0;
477 caffe_gpu_dot(count, data, loss_weights, &blob_loss);
478 loss += blob_loss;
479 }
480#endif
481 break;
482 default:
483 LOG(FATAL) << "Unknown caffe mode.";
484 }
485 Unlock();
486 return loss;
487}
488
489template <typename Dtype>
490inline void Layer<Dtype>::Backward(const vector<Blob<Dtype>*>& top,

Callers 15

testFunction · 0.80
timeFunction · 0.80
SolveMethod · 0.80
TestMethod · 0.80
ForwardFromToMethod · 0.80
TYPED_TESTFunction · 0.80
TYPED_TESTFunction · 0.80
TestForwardMethod · 0.80
RunLeastSquaresSolverMethod · 0.80
TYPED_TESTFunction · 0.80

Calls 8

lossMethod · 0.95
caffe_cpu_dotFunction · 0.85
countMethod · 0.80
cpu_diffMethod · 0.80
gpu_diffMethod · 0.80
sizeMethod · 0.45
cpu_dataMethod · 0.45
gpu_dataMethod · 0.45

Tested by 15

TestMethod · 0.64
TYPED_TESTFunction · 0.64
TYPED_TESTFunction · 0.64
TestForwardMethod · 0.64
RunLeastSquaresSolverMethod · 0.64
TYPED_TESTFunction · 0.64
TestForwardMethod · 0.64
TestForwardMethod · 0.64
TYPED_TESTFunction · 0.64
TYPED_TESTFunction · 0.64
TYPED_TESTFunction · 0.64