You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by GitBox <gi...@apache.org> on 2019/01/16 05:43:59 UTC

[incubator-mxnet] Diff for: [GitHub] szha merged pull request #13899: fix bug in profiler tutorial when using cpu

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)


With regards,
Apache Git Services