| 9 | |
| 10 | template <typename Dtype> |
| 11 | void 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 | |
| 32 | template <typename Dtype> |
| 33 | void ArgMaxLayer<Dtype>::Reshape(const vector<Blob<Dtype>*>& bottom, |
nothing calls this directly
no test coverage detected