mindspore.hal.reset_peak_memory_stats

View Source On Gitee
mindspore.hal.reset_peak_memory_stats(device_target=None)[source]

Reset the "peak" stats tracked by memory manager, this api will be deprecated and removed in future versions. Please use the api mindspore.runtime.reset_peak_memory_stats() instead.

Parameters

device_target (str, optional) – The target device specified, should be one of "CPU" , "GPU" and "Ascend" . Default None , 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_reserved())
1073741824
>>> print(mindspore.hal.max_memory_allocated())
1536
>>> mindspore.hal.reset_peak_memory_stats()
>>> print(mindspore.hal.max_memory_reserved())
0
>>> print(mindspore.hal.max_memory_allocated())
0