szha commented on a change in pull request #14849: [Fit API] update estimator
URL: https://github.com/apache/incubator-mxnet/pull/14849#discussion_r279999602
##########
File path: python/mxnet/gluon/contrib/estimator/estimator.py
##########
@@ -88,12 +88,17 @@ def _check_metrics(self, metrics):
return metrics
def _check_context(self, context):
- # handle context
- if isinstance(context, Context):
- context = [context]
- elif isinstance(context, list) and all([isinstance(c, Context) for c
in context]):
- context = context
- elif not context:
+ if context:
+ # check context values, only accept Context or a list of Context
+ if isinstance(context, Context):
+ context = [context]
+ elif isinstance(context, list) and all([isinstance(c, Context) for
c in context]):
+ context = context
Review comment:
cpu(65536) is actually valid in mxnet regardless of the number of physical
CPUs, whereas `cpu()` refers to `cpu(0)`. For GPU, the check is fine, but for
CPU, we might need to do a more general check.
----------------------------------------------------------------
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