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

Method LayerSetUp

src/caffe/layers/crop_layer.cpp:16–33  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

14
15template <typename Dtype>
16void 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
35template <typename Dtype>
36void CropLayer<Dtype>::Reshape(const vector<Blob<Dtype>*>& bottom,

Callers

nothing calls this directly

Calls 3

num_axesMethod · 0.80
CanonicalAxisIndexMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected