Rate this Page

Aliases in torch.cuda#

Created On: Sep 21, 2025 | Last Updated On: Sep 21, 2025

The following are aliases to their counterparts in torch.cuda in the nested namespaces in which they are defined. For any of these APIs, feel free to use the top-level version in torch.cuda like torch.cuda.seed or the nested version torch.cuda.random.seed.

get_rng_state

Return the random number generator state of the specified GPU as a ByteTensor.

get_rng_state_all

Return a list of ByteTensor representing the random number states of all devices.

set_rng_state

Set the random number generator state of the specified GPU.

set_rng_state_all

Set the random number generator state of all devices.

manual_seed

Set the seed for generating random numbers for the current GPU.

manual_seed_all

Set the seed for generating random numbers on all GPUs.

seed

Set the seed for generating random numbers to a random number for the current GPU.

seed_all

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

initial_seed

Return the current random seed of the current GPU.

is_current_stream_capturing

Return True if CUDA graph capture is underway on the current CUDA stream, False otherwise.

graph_pool_handle

Return an opaque token representing the id of a graph memory pool.

CUDAGraph

Wrapper around a CUDA graph.

graph

Context-manager that captures CUDA work into a torch.cuda.CUDAGraph object for later replay.

make_graphed_callables

Accept callables (functions or nn.Modules) and returns graphed versions.

Stream

Wrapper around a CUDA stream.

ExternalStream

Wrapper around an externally allocated CUDA stream.

Event

Wrapper around a CUDA event.