roywei commented on a change in pull request #14494: [MXNet-1340][Fit 
API]Adding train history class
URL: https://github.com/apache/incubator-mxnet/pull/14494#discussion_r269788325
 
 

 ##########
 File path: python/mxnet/gluon/trainer.py
 ##########
 @@ -259,6 +259,13 @@ def learning_rate(self):
         else:
             return self._optimizer.learning_rate
 
+    @property
+    def optimizer(self):
+        if isinstance(self._optimizer, opt.Optimizer):
+            return self._optimizer
+        else:
+            raise UserWarning("Optimizer has not been initialized yet")
 
 Review comment:
   a custom optimizer should still inherit the base Optimizer class. Gluon 
trainer does the check: 
https://github.com/apache/incubator-mxnet/blob/master/python/mxnet/gluon/trainer.py#L123

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to