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 2018/05/25 07:34:04 UTC
[GitHub] solin319 opened a new issue #11061: mx.nd.argmax is slow
solin319 opened a new issue #11061: mx.nd.argmax is slow
URL: https://github.com/apache/incubator-mxnet/issues/11061
```
import time
import mxnet as mx
import numpy as np
import os
tmp = mx.nd.random.uniform(-1, 1, shape=(64,300000), ctx=mx.gpu())
#tmp = np.random.RandomState().uniform(-1, 1, (64,300000))
tic = time.time()
for i in range(20):
if (i == 5):
begin = time.time();
elif (i == 15):
end = time.time();
tic = time.time()
max = mx.nd.argmax(tmp, axis=1)
#max = np.argmax(tmp, axis=1)
print max[0]
toc = time.time() - tic
print ("used time %f:"%toc)
avg = (end - begin) / 10
print ("avg time %f"%avg)
```
We use code before to test the speed of argmax.
NDArray in cpu use 0.112895s.
NDArray in gpu use 0.280577.
numpy.array only use 0.018021.
Why mx.nd.argmax is so slow?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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