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

Inconsistent behaviour nd.argmax against np.argmax when there are 'nans' in data #16216

Closed
access2rohit opened this issue Sep 19, 2019 · 4 comments
Labels

Comments

@access2rohit
Copy link
Contributor

access2rohit commented Sep 19, 2019

below is a reproducable example to display inconsistencies in argmax in mxnet and numpy

>>> import mxnet as mx
>>> import mxnet.ndarray as nd
>>> x = np.array([[1,5,3],[float('nan'), 2,6]])
>>> x
array([[ 1.,  5.,  3.],
      [nan,  2.,  6.]])
>>> y = nd.array(x)
shape=(2, 3)
[14:05:53] src/c_api/c_api.cc:190: MXNDArrayCreateExInt64 shape=2
>>> nd.argmax(y, axis=0)
[0. 0. 1.]
<NDArray 3 @cpu(0)>
>>> nd.argmax(y, axis=1)
[1. 2.]
<NDArray 2 @cpu(0)>
>>> import numpy as np
>>> np.argmax(x, axis=0)
array([1, 0, 1])
>>> np.argmax(x, axis=1)
array([1, 0])
@mxnet-label-bot
Copy link
Contributor

Hey, this is the MXNet Label Bot.
Thank you for submitting the issue! I will try and suggest some labels so that the appropriate MXNet community members can help resolve it.
Here are my recommended label(s): Bug

@access2rohit
Copy link
Contributor Author

@mxnet-label-bot add [numpy]

@access2rohit
Copy link
Contributor Author

@reminisce @szha

@haojin2
Copy link
Contributor

haojin2 commented Dec 30, 2019

@access2rohit Seems like this issue has been addressed in the latest nightly build (mxnet-mkl==1.6.0b20191229):

>>> import mxnet as mx
>>> import mxnet.ndarray as nd
>>> import numpy as np
>>> x = np.array([[1,5,3],[float('nan'), 2,6]])
>>> y = nd.array(x)
>>> nd.argmax(y, axis=0)

[1. 0. 1.]
<NDArray 3 @cpu(0)>
>>> nd.argmax(y, axis=1)

[1. 0.]
<NDArray 2 @cpu(0)>

Closing this issue now, if you found the problem is not solved please feel free to re-open this issue.

@haojin2 haojin2 closed this as completed Dec 30, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants