szha closed pull request #13695: fix bug in profiler tutorial when using cpu URL: https://github.com/apache/incubator-mxnet/pull/13695
This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/docs/tutorials/python/profiler.md b/docs/tutorials/python/profiler.md index d99bb19ee02..7dcda10f11b 100644 --- a/docs/tutorials/python/profiler.md +++ b/docs/tutorials/python/profiler.md @@ -94,10 +94,10 @@ Let's define a method that will run one training iteration given data and label. ```python # Use GPU if available -try: - mx.test_utils.list_gpus(); ctx = mx.gpu() -except: - ctx = mx.cpu() +if len(mx.test_utils.list_gpus())!=0: + ctx=mx.gpu() +else: + ctx=mx.cpu() # Initialize the parameters with random weights net.collect_params().initialize(mx.init.Xavier(), ctx=ctx) ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on 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