-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathinput_layer.cpp
More file actions
27 lines (22 loc) · 834 Bytes
/
input_layer.cpp
File metadata and controls
27 lines (22 loc) · 834 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include <vector>
#include "caffe/layers/input_layer.hpp"
namespace caffe {
template <typename Dtype>
void InputLayer<Dtype>::LayerSetUp(const vector<Blob<Dtype>*>& bottom,
const vector<Blob<Dtype>*>& top) {
const int num_top = top.size();
const InputParameter& param = this->layer_param_.input_param();
const int num_shape = param.shape_size();
CHECK(num_shape == 0 || num_shape == 1 || num_shape == num_top)
<< "Must specify 'shape' once, once per top blob, or not at all: "
<< num_top << " tops vs. " << num_shape << " shapes.";
if (num_shape > 0) {
for (int i = 0; i < num_top; ++i) {
const int shape_index = (param.shape_size() == 1) ? 0 : i;
top[i]->Reshape(param.shape(shape_index));
}
}
}
INSTANTIATE_CLASS(InputLayer);
REGISTER_LAYER_CLASS(Input);
} // namespace caffe