mindspore.hal.reset_peak_memory_stats
- mindspore.hal.reset_peak_memory_stats(device_target=None)[source]
Reset the "peak" stats tracked by memory manager.
Note
If device_target is not specified, get the device capability of the current backend set by context.
- Parameters
device_target (str, optional) – The device name of backend, should be one of "CPU", "GPU" and "Ascend". Default value:
None
.
Examples
>>> import mindspore as ms >>> import numpy as np >>> from mindspore import Tensor, ops >>> a = Tensor(np.ones([1, 2]), ms.float32) >>> b = Tensor(np.ones([1, 2]), ms.float32) >>> c = ops.add(a, b).asnumpy() >>> print(ms.hal.max_memory_reserved()) 1073741824 >>> print(ms.hal.max_memory_allocated()) 1536 >>> ms.hal.reset_peak_memory_stats() >>> print(ms.hal.max_memory_reserved()) 0 >>> print(ms.hal.max_memory_allocated()) 0