memory_reserved

paddle.device.xpu. memory_reserved ( device: _XPUPlaceLike | None = None ) int [source]

Return the current size of XPU memory that is held by the allocator of the given device.

Parameters

device (paddle.XPUPlace|int|str|None, optional) – The device, the id of the device or the string name of device like ‘xpu:x’. If device is None, the device is the current device. Default: None.

Returns

The current size of XPU memory that is held by the allocator of the given device, in bytes.

Return type

int

Examples

>>> 
>>> import paddle
>>> paddle.device.set_device('xpu')

>>> memory_reserved_size = paddle.device.xpu.memory_reserved(paddle.XPUPlace(0))
>>> memory_reserved_size = paddle.device.xpu.memory_reserved(0)
>>> memory_reserved_size = paddle.device.xpu.memory_reserved("xpu:0")