explicitly specify device placement in random number generator in e3nn.math._normalize_activation.moment #492
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
In line 17 of
e3nn/math/_normalize_activation.py, I changed frome3nn/e3nn/math/_normalize_activation.py
Line 17 in 8c9891d
to
Motivation and Context
Background: I'm using E3NN in a training code written with pytorch-lightning. During the training process, I encountered the following error:
From the code I assume the process is to create a random number array on CPU and then copy to GPU. Under the environment of the pytorch-lightning, it must be trying the create the random number array on GPU and failed since everything else has been placed explicitly on CPU.
Therefore I propose to add the
device="cpu"to thetorch.randnfunction call, to avoid this error.How Has This Been Tested?
I have tested the fixed code training my own model. It successfully fixed the error.
Since the edit is minimal, it should be safe from introducing bugs.
Checklist: