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 2018/04/07 01:35:54 UTC
[GitHub] roywei commented on issue #8337: mx.autograd.grad works or fails depending on use of slices
roywei commented on issue #8337: mx.autograd.grad works or fails depending on use of slices
URL: https://github.com/apache/incubator-mxnet/issues/8337#issuecomment-379423074
@kpot may I know what's the purpose of slice? let's say if you want a[0:2], how you want to use it?
`a[0:4]` is a shallow copy of `a` , using slice in autograd may not be the idea way.
In your case for OpenCL device, could you try to use symbolic gradient directly from nnvm? refer to [gradient](https://github.com/dmlc/nnvm/blob/master/src/pass/gradient.cc) and [test](https://github.com/dmlc/nnvm/blob/master/tests/python/compiler/test_optimizer.py#L33)
```
a = mx.nd.array([1, 2, 3, 4], ctx=ctx)
print(id(a))
print(id(a[0:4]))
>>>4387046120
>>>4387048864
----------------------------------------------------------------
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