W3cubDocs

/PyTorch 2.9

torch.cuda.seed_all

torch.cuda.seed_all() [source]

Set the seed for generating random numbers to a random number on all GPUs.

It’s safe to call this function if CUDA is not available; in that case, it is silently ignored.

© 2025, PyTorch Contributors
PyTorch has a BSD-style license, as found in the LICENSE file.
https://docs.pytorch.org/docs/2.9/generated/torch.cuda.seed_all.html