W3cubDocs

/PyTorch 2.9

torch.cuda.memory.get_per_process_memory_fraction

torch.cuda.memory.get_per_process_memory_fraction(device=None) [source]

Get memory fraction for a process.

Parameters

device (torch.device or int, optional) – selected device. If it is None the default CUDA device is used.

Returns

memory fraction, in range 0~1. Allowed memory equals total_memory * fraction.

Return type

float

© 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.memory.get_per_process_memory_fraction.html