| 14 | |
| 15 | template <typename Dtype> |
| 16 | void CropLayer<Dtype>::LayerSetUp(const vector<Blob<Dtype>*>& bottom, |
| 17 | const vector<Blob<Dtype>*>& top) { |
| 18 | // LayerSetup() handles the number of dimensions; Reshape() handles the sizes. |
| 19 | // bottom[0] supplies the data |
| 20 | // bottom[1] supplies the size |
| 21 | const CropParameter& param = this->layer_param_.crop_param(); |
| 22 | CHECK_EQ(bottom.size(), 2) << "Wrong number of bottom blobs."; |
| 23 | int input_dim = bottom[0]->num_axes(); |
| 24 | const int start_axis = bottom[0]->CanonicalAxisIndex(param.axis()); |
| 25 | CHECK_LT(start_axis, input_dim) << "crop axis bigger than input dim"; |
| 26 | if (param.offset_size() > 1) { |
| 27 | // the number of crop values specified must be equal to the number |
| 28 | // of dimensions following axis |
| 29 | CHECK_EQ(start_axis + param.offset_size(), input_dim) |
| 30 | << "number of offset values specified must be equal to the number of " |
| 31 | << "dimensions following axis."; |
| 32 | } |
| 33 | } |
| 34 | |
| 35 | template <typename Dtype> |
| 36 | void CropLayer<Dtype>::Reshape(const vector<Blob<Dtype>*>& bottom, |
nothing calls this directly
no test coverage detected