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

Commit

Permalink
Correctly set the device context to CPU at symbolic mode when --gpus …
Browse files Browse the repository at this point in the history
…not set (#10646)

* Correctly set the device context to CPU at symbolic mode when --gpus not set

* Fix review comments
  • Loading branch information
juliusshufan authored and piiswrong committed Apr 30, 2018
1 parent 8fdcb85 commit 4d7505a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion example/gluon/image_classification.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ def main():
data = mx.sym.var('data')
out = net(data)
softmax = mx.sym.SoftmaxOutput(out, name='softmax')
mod = mx.mod.Module(softmax, context=[mx.gpu(i) for i in range(num_gpus)] if num_gpus > 0 else [mx.cpu()])
mod = mx.mod.Module(softmax, context=context)
kv = mx.kv.create(opt.kvstore)
train_data, val_data = get_data_iters(dataset, batch_size, kv.num_workers, kv.rank)
mod.fit(train_data,
Expand Down

0 comments on commit 4d7505a

Please sign in to comment.