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/08/07 23:14:52 UTC
[GitHub] [incubator-mxnet] sxjscience opened a new issue #18878: [Bug] Reduction operators in numpy does not support explicitly set `keepdims` to Non
sxjscience opened a new issue #18878:
URL: https://github.com/apache/incubator-mxnet/issues/18878
Minimal reproducible example:
```python
import mxnet as mx
from mxnet.gluon.nn import HybridBlock
mx.npx.set_np()
class Foo(HybridBlock):
def hybrid_forward(self, F, x):
return F.np.mean(x, keepdims=None)
foo = Foo()
foo.hybridize()
out = foo(mx.np.ones((10, 10)))
out.asnumpy()
```
Output:
```
MXNetError: MXNetError: Invalid Parameter format for keepdims expect boolean but value='None', in operator _npi_mean(name="", __profiler_scope__="foo0:", axis="None", keepdims="None")
```
The root cause is that we should revise https://github.com/apache/incubator-mxnet/blob/dde635f8c7666e205816da8ca4e519d0d213523f/src/operator/numpy/np_broadcast_reduce_op.h#L43 to use `dmlc::optional<bool>`.
----------------------------------------------------------------
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
[GitHub] [incubator-mxnet] sxjscience commented on issue #18878: [Bug] Reduction operators in numpy does not support explicitly set `keepdims` to Non
Posted by GitBox <gi...@apache.org>.
sxjscience commented on issue #18878:
URL: https://github.com/apache/incubator-mxnet/issues/18878#issuecomment-670791217
OK, just realized that numpy does not support None either so it's expected.
```
~/miniconda3/lib/python3.7/site-packages/numpy/core/fromnumeric.py in sum(a, axis, dtype, out, keepdims, initial, where)
2227
2228 return _wrapreduction(a, np.add, 'sum', axis, dtype, out, keepdims=keepdims,
-> 2229 initial=initial, where=where)
2230
2231
~/miniconda3/lib/python3.7/site-packages/numpy/core/fromnumeric.py in _wrapreduction(obj, ufunc, method, axis, dtype, out, **kwargs)
88 return reduction(axis=axis, out=out, **passkwargs)
89
---> 90 return ufunc.reduce(obj, axis, dtype, out, **passkwargs)
91
92
TypeError: an integer is required (got type NoneType)
```
----------------------------------------------------------------
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
[GitHub] [incubator-mxnet] sxjscience closed issue #18878: [Bug] Reduction operators in numpy does not support explicitly set `keepdims` to Non
Posted by GitBox <gi...@apache.org>.
sxjscience closed issue #18878:
URL: https://github.com/apache/incubator-mxnet/issues/18878
----------------------------------------------------------------
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
[GitHub] [incubator-mxnet] szha commented on issue #18878: [Bug] Reduction operators in numpy does not support explicitly set `keepdims` to Non
Posted by GitBox <gi...@apache.org>.
szha commented on issue #18878:
URL: https://github.com/apache/incubator-mxnet/issues/18878#issuecomment-670790738
What's the expected behavior in official numpy?
----------------------------------------------------------------
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