sxjscience commented on issue #17638: [Numpy] unknown type_flag=7
URL: 
https://github.com/apache/incubator-mxnet/issues/17638#issuecomment-589329816
 
 
   I find it could be further simplified:
   
   ```python
   import mxnet as mx
   import numpy as np
   from numpy.testing import assert_allclose
   from mxnet.gluon import HybridBlock
   mx.npx.set_np()
   
   class Foo(HybridBlock):
       def __init__(self, prefix=None, params=None):
           super(Foo, self).__init__(prefix=prefix, params=params)
   
       def hybrid_forward(self, F, valid_length):
           mask = (F.np.ones((10,)) < valid_length).astype(np.float32)
           return mask
   
   foo = Foo()
   foo.hybridize()
   out = foo(mx.np.ones((10,), ctx=mx.gpu()))
   print(out)
   ```

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to