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 2020/03/07 06:44:45 UTC

[GitHub] [incubator-mxnet] arcadiaphy opened a new issue #17785: Inconsistency between HybridBlock and Block

arcadiaphy opened a new issue #17785: Inconsistency between HybridBlock and Block
URL: https://github.com/apache/incubator-mxnet/issues/17785
 
 
   Following #16279, another example of inconsistency between HybridBlock and Block:
   
   ```
   import mxnet as mx
   from mxnet.gluon import HybridBlock
   
   class Foo(HybridBlock):
       def hybrid_forward(self, F, a, b):
           return a + b
   
   
   b1 = Foo(prefix='non_hybrid')
   b2 = Foo(prefix='hybrid')
   b2.hybridize()
   
   print(b1(mx.nd.ones((10,)), mx.nd.ones((1,))))
   print(b2(mx.nd.ones((10,)), mx.nd.ones((1,))))
   ```
   
   MXNetError is triggered for non-hybridized case:
   
   ```
   MXNetError: MXNetError: Error in operator hybridized_plus0: [14:24:15] src/operator/numpy/linalg/../../tensor/../elemwise_op_common.h:135: Check failed: assign(&dattr, vec.at(i)): Incompatible attr in node hybridized_plus0 at 1-th input: expected [10], got [1]
   ```
   
   I think it's because for symbol, `elemwise_add` is used for `__add__`, while for ndarray broadcasting is considered in `__add__` considering input shape.
   
   Can we add broadcasting in symbol too and avoid the need to differentiate between `elemwise_add` and `broadcast_add`?
   
   Note that the same problem exists in subtract, multiply and divide operation, too.

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