MLU memory optimization (#7470)

Co-authored-by: huzhan <huzhan@cambricon.com>
This commit is contained in:
BiologicalExplosion 2025-04-03 07:24:04 +08:00 committed by GitHub
parent ab5413351e
commit 2222cf67fd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1237,6 +1237,8 @@ def soft_empty_cache(force=False):
torch.xpu.empty_cache()
elif is_ascend_npu():
torch.npu.empty_cache()
elif is_mlu():
torch.mlu.empty_cache()
elif torch.cuda.is_available():
torch.cuda.empty_cache()
torch.cuda.ipc_collect()