lightingghost commented on issue #10220: Check failed: 
!ndinputs.back()->is_none()
URL: 
https://github.com/apache/incubator-mxnet/issues/10220#issuecomment-386832157
 
 
   It seem this error is related to the `FullyConnected` operator. The 
following code will reproduce the error:
   ```python
   x = nd.ones((3, 2))
   y = nd.ones((2, 20))
   y.attach_grad()
   z = g.Parameter('weight', shape=(20, 2))
   z.initialize(ctx=mx.cpu())
   with autograd.record():
       #a = nd.dot(x, z.data(), transpose_b=True)
       a = nd.FullyConnected(x, z.data(), None, num_hidden=20, no_bias=True)
       a = a.reshape((-1, 4, 5))
       b = nd.ones((3, 5, 6))
       a = 0.5 <= a
       e = nd.batch_dot(a, b)
       f = e.sum()
   f.backward()
   ```
   
   But changing `FullyConnected` to `dot` will be fine. Further dive into the 
`imperative.cc` shows the heap address of the output of `FullyConnected` was 
used to store the output of `reshape` and then `sum`, making the backward 
function unable to find the output of `FullyConnected`.
   
   As a workaround, I can write my own `Dense` block which use `dot` instead of 
`FullyConnected`, but I think this problem still worth investigation. Btw, why 
does `Dense` use `FullyConnected` instead of `dot` initially? Doing the 
multiplication and addition in a single operator?
   
   Another thing is, the `info` property in `NDArray` has type of `dmlc::any`, 
which is very hard to debug in `lldb`, is there a method you suggest that can 
see the content in `info`? 
   
   Thanks

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