| 6 | |
| 7 | template <typename Dtype> |
| 8 | void InputLayer<Dtype>::LayerSetUp(const vector<Blob<Dtype>*>& bottom, |
| 9 | const vector<Blob<Dtype>*>& top) { |
| 10 | const int num_top = top.size(); |
| 11 | const InputParameter& param = this->layer_param_.input_param(); |
| 12 | const int num_shape = param.shape_size(); |
| 13 | CHECK(num_shape == 0 || num_shape == 1 || num_shape == num_top) |
| 14 | << "Must specify 'shape' once, once per top blob, or not at all: " |
| 15 | << num_top << " tops vs. " << num_shape << " shapes."; |
| 16 | if (num_shape > 0) { |
| 17 | for (int i = 0; i < num_top; ++i) { |
| 18 | const int shape_index = (param.shape_size() == 1) ? 0 : i; |
| 19 | top[i]->Reshape(param.shape(shape_index)); |
| 20 | } |
| 21 | } |
| 22 | } |
| 23 | |
| 24 | INSTANTIATE_CLASS(InputLayer); |
| 25 | REGISTER_LAYER_CLASS(Input); |