| 8 | |
| 9 | template <typename Dtype> |
| 10 | void 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 | |
| 26 | template <typename Dtype> |
| 27 | void SoftmaxLayer<Dtype>::Forward_cpu(const vector<Blob<Dtype>*>& bottom, |
nothing calls this directly
no test coverage detected