首页
it技术
登录
6mi
u
盘
搜
搜 索
it技术
训练没问题测试报内存溢出:RuntimeError: CUDA out of memory...
训练没问题测试报内存溢出:RuntimeError: CUDA out of memory...
it
2025-04-10
21
OOM报错如图所示: 训练跑得好好的,怎么测试的时候反倒报错了呢? 原来是没有加with torch.no_grad(),在测试的时候有gradient容易报内存溢出,加上:
with
torch
.
no_grad
(
)
:
testY
=
model
(
testX
)
再跑代码就OK了。
转载请注明原文地址: https://lol.8miu.com/read-24706.html
最新回复
(
0
)