Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Fail to use "==" operation between different types #18299

Closed
acphile opened this issue May 13, 2020 · 1 comment · Fixed by #18427
Closed

Fail to use "==" operation between different types #18299

acphile opened this issue May 13, 2020 · 1 comment · Fixed by #18427

Comments

@acphile
Copy link
Contributor

acphile commented May 13, 2020

for example

import mxnet as mx
mx.npx.set_np()
mx.np.arange(5)
array([0., 1., 2., 3., 4.])
b=mx.np.arange(5)
a=b.astype('int32')
a==b

it will raise Error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/ubuntu/incubator-mxnet/python/mxnet/numpy/multiarray.py", line 991, in __eq__
    return equal(self, other)
  File "/home/ubuntu/incubator-mxnet/python/mxnet/numpy/multiarray.py", line 8451, in equal
    return _mx_nd_np.equal(x1, x2, out)
  File "/home/ubuntu/incubator-mxnet/python/mxnet/ndarray/numpy/_op.py", line 6622, in equal
    return _api_internal.equal(x1, x2, out)
  File "/home/ubuntu/incubator-mxnet/python/mxnet/_ffi/_ctypes/function.py", line 115, in __call__
    raise get_last_ffi_error()
mxnet.base.MXNetError: MXNetError: Type inconsistent, Provided = float32, inferred type = int32

But numpy supports "==" operation between different types

@yzhliu
Copy link
Member

yzhliu commented May 21, 2020

@BenjaminCHEN2016 will be helping after #18277 is merged.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants