You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by GitBox <gi...@apache.org> on 2019/10/31 10:44:57 UTC

[GitHub] [incubator-mxnet] zixuanweeei opened a new pull request #16682: [mkldnn-v1.0] Must reorder and emplace weights for rnn inference primitives

zixuanweeei opened a new pull request #16682: [mkldnn-v1.0] Must reorder and emplace weights for rnn inference primitives
URL: https://github.com/apache/incubator-mxnet/pull/16682
 
 
   ## Description ##
   Some problems that the primitives cannot be executed  or give wrong results will appear in the case below,
   https://github.com/apache/incubator-mxnet/blob/b5d07e30321da47d604b99048c1b57c03ec819b0/tests/python/unittest/test_operator.py#L103-L108
   
   For better performance of `forward(is_train=True)`, `ReorderWeights` is no longer used as forward training only uses plain memory. When we then invoke `forward(is_train=False)`, the required `ReorderWeights` may not be executed as the operator has been already initialized. As a consequence, the forward primitives may give wrong results. The same thing will happen with `EmplaceNetArgs`, which results in the unable executing of primitives. Currently, we use `ctx.is_train || ctx.need_grad` to check if the operator requires preparing data for forward training. Things become more complicated with the usage above, especially with `grad_req` specified. It needs a further design for the stateful RNN operator. 
   
   ## Checklist ##
   ### Changes ###
   - [x] Must reorder and emplace weights in initailization.
   
   ## Comments ##
   - Actually, reorder and emplace must be executed over the previous commit before b38d6a9ab415bba8c6c0d0cddf0f2ffcaff53a27. But it has a mistake in the code, which was fixed by b38d6a9ab415bba8c6c0d0cddf0f2ffcaff53a27. This PR just fixes the problem above based on that commit. We left a never used variable `is_train` in `SetWeightsMem(...)`for some potential uses of further design.
   - We prefer to have #16555 merged due to the limited time to 1.6 release.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services