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/06 18:44:24 UTC

[GitHub] reminisce commented on issue #8048: Bug in backprop for the transpose of a transpose

reminisce commented on issue #8048: Bug in backprop for the transpose of a transpose
URL: https://github.com/apache/incubator-mxnet/issues/8048#issuecomment-379342136
 
 
   @dmadeka I was trying to debug this issue, but couldn't reproduce it using the latest master branch code. My script is as the following. Could you please confirm whether the problem still exists? From what you described, this is more like an issue of the graph executor assigning wrong `req` to the input of the `transpose` operator.
   ```python
   import mxnet as mx
   
   
   def ttake(x, i):
       """Take from axis 1 instead of 0."""
       return mx.sym.flatten(mx.sym.transpose(mx.sym.take(mx.sym.transpose(x), i)))
   
   
   shape = (4, 5)
   data = mx.sym.Variable('data', shape=(4, 5))
   indices = mx.sym.Variable('indices', shape=(1,))
   sym = ttake(data, indices)
   exe = sym.simple_bind(ctx=mx.cpu(), grad_req={'data': 'write', 'indices': 'null'})
   exe.arg_dict[data.name][:] = mx.nd.arange(shape[0] * shape[1]).reshape(shape)
   exe.arg_dict[indices.name][:] = mx.nd.array([0], dtype='int32')
   print(exe.arg_dict[data.name])
   output = exe.forward()[0]
   exe.backward(output)
   print(exe.grad_arrays[0].asnumpy())
   ```

----------------------------------------------------------------
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