paddle.device.empty_cache()
释放当前设备上所有未占用的缓存内存。
import paddle x = paddle.randn([1000, 1000]) del x paddle.device.empty_cache()