Skip to content
Discussion options

You must be logged in to vote

There is no difference between torch.manual_seed and torch.cuda.manual_seed when running on single GPU or without GPU.

So, torch.cuda.manual_seed sets manual seed for the current GPU

WARNING
If you are working with a multi-GPU model, this function is insufficient to get determinism. To seed all GPUs, use manual_seed_all().

and torch.manual_seed sets manual seed across all CPU(s) and GPU(s).

NOTE: When using torch.manual_seed or torch.cuda.manual_seed, the reproducibility also depends on the device on which tensor was created. So, If we use any of the reproducibility functions, there will be a different Tensor for both CPU and GPU.

Source: PyTorch Reproducibility Documentation, torch.cud…

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
2 replies
@Perian-Yan
Comment options

@AS1100K
Comment options

Answer selected by Perian-Yan
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants