解决mxnet报错:“ZeroDivisionError: float division by zero”

  在运行mxnet的线性回归例子时,出现报错:ZeroDivisionError: float division by zero
  解决:
  把

model.fit(train_iter, eval_iter,
            optimizer_params={'learning_rate':0.005, 'momentum': 0.9},
            num_epoch=50,
            eval_metric='mse',
            batch_end_callback = mx.callback.Speedometer(batch_size, 2))

  改为:

model.fit(train_iter, eval_iter,
            optimizer_params={'learning_rate':0.005, 'momentum': 0.9},
            num_epoch=50,
            eval_metric='mse',
            batch_end_callback = mx.callback.Speedometer(batch_size, 50))

  即把Speedometer的参数从2变成50。

参考:https://stackoverflow.com/questions/48401060/mxnet-regression-divide-by-zero-error

你可能感兴趣的:(mxnet,mxnet)