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 2019/07/22 13:15:54 UTC

[GitHub] [incubator-mxnet] DeepDuke opened a new issue #15624: asnumpy() took a lot of time when converting NDARRAY into numpy?

DeepDuke opened a new issue #15624: asnumpy() took a lot of time when converting NDARRAY into numpy?
URL: https://github.com/apache/incubator-mxnet/issues/15624
 
 
   I  found a strange thing that when I convert `NDARRAY`  into `numpy` for a lot of times,  `asnumpy()`  will took much more time for the first time. When I ran on  gpu:
   
   `import mxnet as mx
   from mxnet import nd
   import time
   
   with mx.Context(mx.gpu(0)):
   	for i in range(10):
   		t1 = time.time()
   		a = nd.array([14, 15])
   		a = a.asnumpy()
   		t2 = time.time()
   		print('Time:{:.6f}'.format(t2-t1))`
   
   The result is:
   `Time:1.156998
   Time:0.000000
   Time:0.000997
   Time:0.000000
   Time:0.000998
   Time:0.000000
   Time:0.000000
   Time:0.000000
   Time:0.000000
   Time:0.000998`
   when i ran on cpu , i also get similar result, but it took less time than on gpu. I'm quite confusing about this.

----------------------------------------------------------------
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


With regards,
Apache Git Services