larroy commented on issue #13409: [MXNET-1234] Fix shape inference problems in 
Activation backward
URL: https://github.com/apache/incubator-mxnet/pull/13409#issuecomment-443760161
 
 
   This never executes on MKL:
   
   
   Only if you bind the relu to cpu() context it does.
   
   ```
   import mxnet as mx
   import numpy as np
   np.random.seed(12345)
   
   num_filter = 256
   num_group = 1
   kernel = (3, 3)
   pad = (1, 1)
   shape = (1, 256, 200, 233)
   
   x = mx.sym.Variable('x')
   w = mx.sym.Variable('w')
   
   conv = mx.sym.Convolution(data=x, weight=w, num_filter=num_filter, 
num_group=num_group, kernel=kernel, no_bias=True, pad=pad)
   relu = mx.sym.Activation(data=conv, act_type='relu', name='relu')
   exe = relu.simple_bind(ctx=mx.gpu(), x=shape)
   
   exe.arg_arrays[0][:] = 
mx.nd.array(np.random.normal(size=exe.arg_arrays[0].shape), ctx=mx.cpu())
   exe.arg_arrays[1][:] = 
mx.nd.array(np.random.normal(size=exe.arg_arrays[1].shape), ctx=mx.cpu())
   
   for i in range(10):
       exe.forward(is_train=True)
       exe.backward(exe.outputs[0])
       o = exe.grad_arrays[0]
       t = o.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:
[email protected]


With regards,
Apache Git Services

Reply via email to