mindspore.hal.reset_max_memory_allocated
- mindspore.hal.reset_max_memory_allocated(device_target=None)[source]
Reset the peak memory size of the memory pool actually occupied by Tensor, this api will be deprecated and removed in future versions, please use the api
mindspore.runtime.reset_max_memory_allocated()
instead.- 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.
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.max_memory_allocated()) 1536 >>> mindspore.hal.reset_max_memory_allocated() >>> print(mindspore.hal.max_memory_allocated()) 0