shuokay opened a new issue #14735: How to update parameter manually with gluon
URL: https://github.com/apache/incubator-mxnet/issues/14735
 
 
   I want to update parameters in the training loop,
   ```python
   for batch in enumerate(train_data):
       forward
       backward
       trainer.step(batch_size)
       mx.nd.waitall()
       params = net.collect_params()
       my_param = params["my_param"]._reduce()  # my_param is update in cpp 
side.
       params["my_param"].set_data(my_param*0)
       mx.nd.waitall()
   ```
   If run in one gpu, the code works well,
   If run in muti gpu and in NativeEngine mode, the code works well,
   If move ` trainer.step(batch_size)` after 
`params["my_param"].set_data(my_param*0)`, the code works well,
   If run in multi gpu and default ENGINE `my_param` get the incorrect result.
   I think maybe I should sync the data after `set_data`, but I did not find 
the right way.

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to