Esempio n. 1
0
 def stat_helper(name, array):
     """wrapper for executor callback"""
     import ctypes
     from mxnet.ndarray import NDArray
     from mxnet.base import NDArrayHandle, py_str
     array = ctypes.cast(array, NDArrayHandle)
     array = NDArray(array, writable=False)
     array.wait_to_read()
     elapsed = float(time.time()-stat_helper.start_time)*1000
     if elapsed>.01:
         print (name, array.shape, ('%.1fms' % (elapsed,)))
     stat_helper.start_time=time.time()
Esempio n. 2
0
 def stat_helper(name, array):
     """wrapper for executor callback"""
     import ctypes
     from mxnet.ndarray import NDArray
     from mxnet.base import NDArrayHandle, py_str
     array = ctypes.cast(array, NDArrayHandle)
     array = NDArray(array, writable=False)
     array.wait_to_read()
     elapsed = float(time.time()-stat_helper.start_time)*1000
     # if elapsed>0.:
     #     print (name, array.shape, ('%.1fms' % (elapsed,)))
     # stat_helper.start_time=time.time()
     array = array.asnumpy()
     print(name, array.shape, np.average(array), np.std(array), ('%.1fms' % (float(time.time()-stat_helper.start_time)*1000)))
     stat_helper.internal_shapes.append((name,array.shape))