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

Method Reshape

src/caffe/layers/softmax_layer.cpp:10–24  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8
9template <typename Dtype>
10void SoftmaxLayer<Dtype>::Reshape(const vector<Blob<Dtype>*>& bottom,
11 const vector<Blob<Dtype>*>& top) {
12 softmax_axis_ =
13 bottom[0]->CanonicalAxisIndex(this->layer_param_.softmax_param().axis());
14 top[0]->ReshapeLike(*bottom[0]);
15 vector<int> mult_dims(1, bottom[0]->shape(softmax_axis_));
16 sum_multiplier_.Reshape(mult_dims);
17 Dtype* multiplier_data = sum_multiplier_.mutable_cpu_data();
18 caffe_set(sum_multiplier_.count(), Dtype(1), multiplier_data);
19 outer_num_ = bottom[0]->count(0, softmax_axis_);
20 inner_num_ = bottom[0]->count(softmax_axis_ + 1);
21 vector<int> scale_dims = bottom[0]->shape();
22 scale_dims[softmax_axis_] = 1;
23 scale_.Reshape(scale_dims);
24}
25
26template <typename Dtype>
27void SoftmaxLayer<Dtype>::Forward_cpu(const vector<Blob<Dtype>*>& bottom,

Callers

nothing calls this directly

Calls 6

caffe_setFunction · 0.85
CanonicalAxisIndexMethod · 0.80
ReshapeLikeMethod · 0.80
shapeMethod · 0.80
countMethod · 0.80
mutable_cpu_dataMethod · 0.45

Tested by

no test coverage detected