memory_used

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

Return the used size of XPU memory of the given device that is held by the XPU Runtime.

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 used size of XPU memory of the given device that is held by the XPU Runtime, in bytes.

Return type

int

Examples

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

>>> memory_used_size = paddle.device.xpu.memory_used(paddle.XPUPlace(0))
>>> memory_used_size = paddle.device.xpu.memory_used(0)
>>> memory_used_size = paddle.device.xpu.memory_used("xpu:0")