MCPcopy Create free account
hub / github.com/OpenPTrack/open_ptrack_v2 / Reshape

Method Reshape

rtpose_wrapper/src/caffe/layers/im2col_layer.cpp:107–128  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

105
106template <typename Dtype>
107void Im2colLayer<Dtype>::Reshape(const vector<Blob<Dtype>*>& bottom,
108 const vector<Blob<Dtype>*>& top) {
109 vector<int> top_shape = bottom[0]->shape();
110 const int* kernel_shape_data = kernel_shape_.cpu_data();
111 const int* stride_data = stride_.cpu_data();
112 const int* pad_data = pad_.cpu_data();
113 const int* dilation_data = dilation_.cpu_data();
114 for (int i = 0; i < num_spatial_axes_; ++i) {
115 top_shape[channel_axis_] *= kernel_shape_data[i];
116 const int input_dim = bottom[0]->shape(channel_axis_ + i + 1);
117 const int kernel_extent = dilation_data[i] * (kernel_shape_data[i] - 1) + 1;
118 const int output_dim = (input_dim + 2 * pad_data[i] - kernel_extent)
119 / stride_data[i] + 1;
120 top_shape[channel_axis_ + i + 1] = output_dim;
121 }
122 top[0]->Reshape(top_shape);
123 num_ = bottom[0]->count(0, channel_axis_);
124 bottom_dim_ = bottom[0]->count(channel_axis_);
125 top_dim_ = top[0]->count(channel_axis_);
126
127 channels_ = bottom[0]->shape(channel_axis_);
128}
129
130template <typename Dtype>
131void Im2colLayer<Dtype>::Forward_cpu(const vector<Blob<Dtype>*>& bottom,

Callers 1

LayerSetUpMethod · 0.45

Calls 3

shapeMethod · 0.80
countMethod · 0.80
cpu_dataMethod · 0.45

Tested by

no test coverage detected