roywei commented on a change in pull request #16900: introduce  gradient update 
handler to the  base estimator
URL: https://github.com/apache/incubator-mxnet/pull/16900#discussion_r350470977
 
 

 ##########
 File path: python/mxnet/gluon/contrib/estimator/estimator.py
 ##########
 @@ -295,13 +295,11 @@ def fit_batch(self, train_batch, batch_axis=0):
 
         with autograd.record():
             pred = [self.net(x) for x in data]
-            loss = [self.loss(y_hat, y) for y_hat, y in zip(pred, label)]
+            loss = [self.loss(y_hat, y) / batch_size for y_hat, y in zip(pred, 
label)]
 
 Review comment:
   Estimator is using Loss from EvalMetrics, if loss is divided by batch_size 
here, it will be divided again in 
https://github.com/apache/incubator-mxnet/blob/master/python/mxnet/metric.py#L1626
   
   May want to update MetricHandler or add options for `update` in 
`EvalMetric.Loss`

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to