This repository has been archived by the owner on Nov 17, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Correctly set the device context to CPU at symbolic mode when --gpus not set #10646
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
piiswrong
reviewed
Apr 23, 2018
@@ -255,7 +255,10 @@ 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()]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not change to
mod = mx.mod.Module(softmax, context=context)
directly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@piiswrong , thanks for review and you are right, commit revised. Thanks.
Hi, looks like the failed case breaking the pre-ci is irrelevant to my commit. Thanks. |
@marcoabreu May I have your approval of this commit? |
marcoabreu
approved these changes
Apr 26, 2018
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, seems like the failure is related to something else
anirudh2290
pushed a commit
to anirudh2290/mxnet
that referenced
this pull request
May 7, 2018
…not set (apache#10646) * Correctly set the device context to CPU at symbolic mode when --gpus not set * Fix review comments
rahul003
pushed a commit
to rahul003/mxnet
that referenced
this pull request
Jun 4, 2018
…not set (apache#10646) * Correctly set the device context to CPU at symbolic mode when --gpus not set * Fix review comments
zheng-da
pushed a commit
to zheng-da/incubator-mxnet
that referenced
this pull request
Jun 28, 2018
…not set (apache#10646) * Correctly set the device context to CPU at symbolic mode when --gpus not set * Fix review comments
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR fixes an issue on example/gluon/image_classification.py, see issue: #10647
When using argument --mode symbolic and not set --gpus, it assumed the script will run on CPU, while actually the device is not correctly set to mx.cpu()
Checklist
Essentials
Please feel free to remove inapplicable items for your PR.
Changes
Comments