mindspore.hal.memory_reserved
- mindspore.hal.memory_reserved(device_target=None)[source]
Returns the total amount of memory currently managed by the memory pool, this api will be deprecated and removed in future versions, please use the api
mindspore.runtime.memory_reserved()
instead.Note
For the CPU device, 0 is always returned.
- Parameters
device_target (str, optional) – The target device specified, should be one of
"CPU"
,"GPU"
and"Ascend"
. DefaultNone
, represents the current device set by context.- Returns
int, in Byte.
Examples
>>> import mindspore >>> a = mindspore.tensor(mindspore.ops.ones([1, 2]), mindspore.float32) >>> b = mindspore.tensor(mindspore.ops.ones([1, 2]), mindspore.float32) >>> c = mindspore.ops.add(a, b).asnumpy() >>> print(mindspore.hal.memory_reserved()) 1073741824