MCPcopy Create free account
hub / github.com/BVLC/caffe / LayerSetUp

Method LayerSetUp

src/caffe/layers/argmax_layer.cpp:11–30  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9
10template <typename Dtype>
11void ArgMaxLayer<Dtype>::LayerSetUp(const vector<Blob<Dtype>*>& bottom,
12 const vector<Blob<Dtype>*>& top) {
13 const ArgMaxParameter& argmax_param = this->layer_param_.argmax_param();
14 out_max_val_ = argmax_param.out_max_val();
15 top_k_ = argmax_param.top_k();
16 has_axis_ = argmax_param.has_axis();
17 CHECK_GE(top_k_, 1) << "top k must not be less than 1.";
18 if (has_axis_) {
19 axis_ = bottom[0]->CanonicalAxisIndex(argmax_param.axis());
20 CHECK_GE(axis_, 0) << "axis must not be less than 0.";
21 CHECK_LE(axis_, bottom[0]->num_axes()) <<
22 "axis must be less than or equal to the number of axis.";
23 CHECK_LE(top_k_, bottom[0]->shape(axis_))
24 << "top_k must be less than or equal to the dimension of the axis.";
25 } else {
26 CHECK_LE(top_k_, bottom[0]->count(1))
27 << "top_k must be less than or equal to"
28 " the dimension of the flattened bottom blob per instance.";
29 }
30}
31
32template <typename Dtype>
33void ArgMaxLayer<Dtype>::Reshape(const vector<Blob<Dtype>*>& bottom,

Callers

nothing calls this directly

Calls 4

CanonicalAxisIndexMethod · 0.80
num_axesMethod · 0.80
shapeMethod · 0.80
countMethod · 0.80

Tested by

no test coverage detected