fix: define device once from use_cuda, eliminating hardcoded cuda:1#9
Merged
Conversation
Replaced two duplicate torch.device("cuda:1" ...) expressions in
GCN.forward and Trainer.__init__ with a single `device` variable
defined alongside `use_cuda` in cell 1. This lets the notebook run
correctly on single-GPU machines (cuda:0) and CPU-only environments
instead of raising a CUDA device error. Updated README GPU section to
match the actual cell location and corrected device selection logic.
Fixes #4
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
device = torch.device("cuda" if use_cuda and torch.cuda.is_available() else "cpu")in cell 1 alongsideuse_cuda = Truetorch.device("cuda:1" ...)expressions inGCN.forward(cell 11) andTrainer.__init__(cell 17) with the shareddevicevariableTest plan
cuda:0only): notebook should selectcuda:0instead of erroring oncuda:1use_cuda = Falsein cell 1; notebook should run on CPUcudastill maps tocuda:0by defaultCloses #4
🤖 Generated with Claude Code