torch.xpu — PyTorch 2.7 documentation (original) (raw)
This package introduces support for the XPU backend, specifically tailored for Intel GPU optimization.
This package is lazily initialized, so you can always import it, and useis_available() to determine if your system supports XPU.
Random Number Generator¶
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. |
initial_seed |
Return the current random seed of the current GPU. |
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. |
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. |
Streams and events¶
Event |
Wrapper around a XPU event. |
Stream |
Wrapper around a XPU stream. |
Memory management¶
empty_cache |
Release all unoccupied cached memory currently held by the caching allocator so that those can be used in other XPU application. |
max_memory_allocated |
Return the maximum GPU memory occupied by tensors in bytes for a given device. |
max_memory_reserved |
Return the maximum GPU memory managed by the caching allocator in bytes for a given device. |
mem_get_info |
Return the global free and total GPU memory for a given device. |
memory_allocated |
Return the current GPU memory occupied by tensors in bytes for a given device. |
memory_reserved |
Return the current GPU memory managed by the caching allocator in bytes for a given device. |
memory_stats |
Return a dictionary of XPU memory allocator statistics for a given device. |
memory_stats_as_nested_dict |
Return the result of memory_stats() as a nested dictionary. |
reset_accumulated_memory_stats |
Reset the "accumulated" (historical) stats tracked by the XPU memory allocator. |
reset_peak_memory_stats |
Reset the "peak" stats tracked by the XPU memory allocator. |