Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Commit

Permalink
fix bug in profiler tutorial when using cpu (#13695)
Browse files Browse the repository at this point in the history
try except approach only goes to ctx=mx.gpu() because test_utils.list_gpus() at least returns empty array and do not producing error
  • Loading branch information
Soonhwan-Kwon authored and szha committed Jan 4, 2019
1 parent fe46cd9 commit 24068c2
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions docs/tutorials/python/profiler.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 24068c2

Please sign in to comment.