# tensorplay.cuda.max_memory_allocated Source: https://www.tensorplay.cn/docs/generated/tensorplay.cuda.max_memory_allocated.html ```python tensorplay.cuda.max_memory_allocated(device: Any = None) → int ``` 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()](/docs/generated/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](/docs/generated/tensorplay.Device.html#tensorplay.Device) or [int](https://docs.python.org/3/builtins/functions.html#int), optional) – selected device. Returns statistic for the current device, given by [current_device()](/docs/generated/tensorplay.cuda.current_device.html#tensorplay.cuda.current_device), if [device](/docs/generated/tensorplay.cuda.device.html#tensorplay.cuda.device) is None (default).