# tensorplay.cuda.max_memory_allocated

Source: https://www.tensorplay.cn/docs/generated/tensorplay.cuda.max_memory_allocated.html

# tensorplay.cuda.max_memory_allocated

tensorplay.cuda.max_memory_allocated(device: [Any](https://docs.python.org/3/library/typing.html#typing.Any) | [None](https://docs.python.org/3/library/constants.html#None) = None) &#x2192; [int](https://docs.python.org/3/library/functions.html#int)[[source]](../_modules/tensorplay/cuda/memory.html#max_memory_allocated)

Return the maximum GPU memory occupied by tensors in bytes for a given device.

By default, this returns the peak allocated memory since the beginning of
this program. [reset_peak_memory_stats()](tensorplay.cuda.reset_peak_memory_stats.html#tensorplay.cuda.reset_peak_memory_stats) can be used to
reset the starting point in tracking this metric.

Parameters:

device ([tensorplay.Device](tensorplay.Device.html#tensorplay.Device) or [int](https://docs.python.org/3/library/functions.html#int), optional) – selected device. Returns
statistic for the current device, given by
[current_device()](tensorplay.cuda.current_device.html#tensorplay.cuda.current_device), if [device](tensorplay.cuda.device.html#tensorplay.cuda.device) is
None (default).
