| 19 | |
| 20 | template <typename Dtype> |
| 21 | void LSTMUnitLayer<Dtype>::Reshape(const vector<Blob<Dtype>*>& bottom, |
| 22 | const vector<Blob<Dtype>*>& top) { |
| 23 | const int num_instances = bottom[0]->shape(1); |
| 24 | for (int i = 0; i < bottom.size(); ++i) { |
| 25 | if (i == 2) { |
| 26 | CHECK_EQ(2, bottom[i]->num_axes()); |
| 27 | } else { |
| 28 | CHECK_EQ(3, bottom[i]->num_axes()); |
| 29 | } |
| 30 | CHECK_EQ(1, bottom[i]->shape(0)); |
| 31 | CHECK_EQ(num_instances, bottom[i]->shape(1)); |
| 32 | } |
| 33 | hidden_dim_ = bottom[0]->shape(2); |
| 34 | CHECK_EQ(4 * hidden_dim_, bottom[1]->shape(2)); |
| 35 | top[0]->ReshapeLike(*bottom[0]); |
| 36 | top[1]->ReshapeLike(*bottom[0]); |
| 37 | X_acts_.ReshapeLike(*bottom[1]); |
| 38 | } |
| 39 | |
| 40 | template <typename Dtype> |
| 41 | void LSTMUnitLayer<Dtype>::Forward_cpu(const vector<Blob<Dtype>*>& bottom, |
nothing calls this directly
no test coverage detected