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/06/30 00:25:49 UTC

[GitHub] Neutron3529 opened a new issue #11504: Callback's bug with very fast speed.

Neutron3529 opened a new issue #11504: Callback's bug with very fast speed.
URL: https://github.com/apache/incubator-mxnet/issues/11504
 
 
   ```
   INFO:root:Epoch[0] Batch [1]    Speed: 323135.90 samples/sec    accuracy=0.102800
   INFO:root:Epoch[0] Batch [2]    Speed: 641232.84 samples/sec    accuracy=0.109800
   Traceback (most recent call last):
     File "<stdin>", line 7, in <module>
     File "d:\program files\python37\lib\site-packages\mxnet\module\base_module.py", line 533, in fit
       callback(batch_end_params)
     File "d:\program files\python37\lib\site-packages\mxnet\callback.py", line 159, in __call__
       speed = self.frequent * self.batch_size / (time.time() - self.tic)
   ```
   ZeroDivisionError: float division by zero
   it seems that time.time may not always return different result, which cause a division by zero exception.
   ```
   >>> [time.time() for i in range(100000)][0::99999]
   [1530318107.497374, 1530318107.497374]
   >>> [time.time() for i in range(100000)][0::99999]
   [1530318108.5909886, 1530318108.6061418]
   ```
   maybe use
   ```
   speed = self.frequent * self.batch_size / (time.time() - self.tic+1e-38)
   ```
   will be better, or mxnet should use a high performance timer rather than time.time
   for example, using `time.perf_counter_ns` may be better
   ```
   >>> [time.perf_counter_ns() for i in range(10)]
   [751763884032, 751763884495, 751763884959, 751763884959, 751763885423, 751763885887, 751763885887, 751763886351, 751763886351, 751763886814]
   ```
   

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