TaoLv commented on a change in pull request #17702: Support projection feature 
for LSTM on CPU (Only Inference)
URL: https://github.com/apache/incubator-mxnet/pull/17702#discussion_r386027073
 
 

 ##########
 File path: src/operator/rnn_impl.h
 ##########
 @@ -219,7 +220,10 @@ void LstmForwardInferenceSingleLayer(DType* ws,
                                      DType* cy_ptr) {
   using namespace mshadow;
   const Tensor<cpu, 2, DType> wx(w_ptr, Shape2(H * 4, I));
-  const Tensor<cpu, 2, DType> wh(w_ptr + I * H * 4, Shape2(H * 4, H));
+  const Tensor<cpu, 2, DType> wh(w_ptr + I * H * 4, Shape2(H * 4, (P ? P : 
H)));
+  Tensor<cpu, 2, DType> whr(w_ptr, Shape2(1, 1));
+  if (P > 0)
+    whr = Tensor<cpu, 2, DType>(wh.dptr_ + P * 4 * H, Shape2(P, H));
 
 Review comment:
   Let's put this into the same line of `if (P > 0)` or add `{. .. }` for it, 
like what you're doing at L236.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to