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/02/19 22:32:58 UTC

[GitHub] ptrendx opened a new pull request #14209: Fix SliceLikeBackward

ptrendx opened a new pull request #14209: Fix SliceLikeBackward
URL: https://github.com/apache/incubator-mxnet/pull/14209
 
 
   ## Description ##
   
   This PR fixes a bug in `slice_like` operator, where, if the first input is constant, the backward pass of this operator would not fill the gradient to the second input with zeros, instead passing random memory contents.
   
   ## Checklist ##
   ### Essentials ###
   Please feel free to remove inapplicable items for your PR.
   - [x] Changes are complete (i.e. I finished coding on this PR)
   - [x] To the my best knowledge, examples are either not affected by this change, or have been fixed to be compatible with this change
   
   ### Changes ###
   - [x] Moved the handling of the second input before the early exit for the first input
   
   ## Comments ##
   - This issue was encountered while working with GluonCV's SSD model, where `slice_like` is used in anchor generator (https://github.com/dmlc/gluon-cv/blob/master/gluoncv/model_zoo/ssd/anchor.py#L70):
   ```
   a = F.slice_like(anchors, x * 0, axes=(2, 3))
   ```
   where the work around was to multiply the second input by 0 (effectively zeroing the gradient). With this PR, this work around is not needed anymore (and it is also not fully safe - NaNs and Infs in the memory returned from SliceLikeBackward would produce NaNs when multiplied by 0 and so would still break the training). @zhreshold FYI
   
   @eric-haibin-lin 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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