TensorPlay
latest (dev)
Copy
View Markdown

Latest development documentation · Updated 2026-10-08

tensorplay.accelerator.memory

Device-agnostic memory queries for the current accelerator.

Every function below targets the active accelerator backend (the GPU backend in this build) and accepts a device object, a spelling such as "cuda:1", an integer index, or None for the current device.

Functions

empty_cache()

Release unoccupied cached device memory held by the allocator.

empty_host_cache()

Release unoccupied cached host memory.

get_memory_info([device])

Free and total device memory in bytes for the given device.

max_memory_allocated([device])

Peak bytes occupied by live tensors on the given device.

max_memory_reserved([device])

Peak bytes managed by the allocator on the given device.

memory_allocated([device])

Bytes currently occupied by live tensors on the given device.

memory_reserved([device])

Bytes currently managed by the allocator on the given device.

memory_stats([device])

Allocator statistics for the given device.

reset_accumulated_memory_stats([device])

Reset historical accumulation counters on the given device.

reset_peak_memory_stats([device])

Reset peak counters on the given device.

Ask DeepWiki