當前位置: 首頁>>編程示例 >>用法及示例精選 >>正文


Python mxnet.callback.Speedometer用法及代碼示例

用法:

class mxnet.callback.Speedometer(batch_size, frequent=50, auto_reset=True)

參數

  • batch_size(int) - 數據的批量大小。
  • frequent(int) - 指定必須記錄訓練速度和評估指標的頻率。默認行為是每 50 個批次記錄一次。
  • auto_reset(bool) - 在每個日誌之後重置評估指標。

基礎:object

定期記錄訓練速度和評估指標。

示例

>>> # Print training speed and evaluation metrics every ten batches. Batch size is one.
>>> module.fit(iterator, num_epoch=n_epoch,
... batch_end_callback=mx.callback.Speedometer(1, 10))
Epoch[0] Batch [10] Speed: 1910.41 samples/sec  Train-accuracy=0.200000
Epoch[0] Batch [20] Speed: 1764.83 samples/sec  Train-accuracy=0.400000
Epoch[0] Batch [30] Speed: 1740.59 samples/sec  Train-accuracy=0.500000

相關用法


注:本文由純淨天空篩選整理自apache.org大神的英文原創作品 mxnet.callback.Speedometer。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。