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

Method SetLossWeights

rtpose_wrapper/include/caffe/layer.hpp:414–428  ·  view source on GitHub ↗

* Called by SetUp to initialize the weights associated with any top blobs in * the loss function. Store non-zero loss weights in the diff blob. */

Source from the content-addressed store, hash-verified

412 * the loss function. Store non-zero loss weights in the diff blob.
413 */
414 inline void SetLossWeights(const vector<Blob<Dtype>*>& top) {
415 const int num_loss_weights = layer_param_.loss_weight_size();
416 if (num_loss_weights) {
417 CHECK_EQ(top.size(), num_loss_weights) << "loss_weight must be "
418 "unspecified or specified once per top blob.";
419 for (int top_id = 0; top_id < top.size(); ++top_id) {
420 const Dtype loss_weight = layer_param_.loss_weight(top_id);
421 if (loss_weight == Dtype(0)) { continue; }
422 this->set_loss(top_id, loss_weight);
423 const int count = top[top_id]->count();
424 Dtype* loss_multiplier = top[top_id]->mutable_cpu_diff();
425 caffe_set(count, loss_weight, loss_multiplier);
426 }
427 }
428 }
429
430 private:
431 /** Whether this layer is actually shared by other nets*/

Callers

nothing calls this directly

Calls 5

set_lossMethod · 0.95
caffe_setFunction · 0.85
countMethod · 0.80
mutable_cpu_diffMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected