使用pytorch grad cam时报错 ValueError: need at least one array to concatenate

使用pytorch grad cam时报错 ValueError: need at least one array to concatenate,第1张

使用pytorch grad cam时报错 ValueError: need at least one array to concatenate grad-cam计算时需要梯度信息,不能冻结模型权值…

果冻结了权值,需要再设置回来

model.requires_grad_(True)

发生以下两种错误,应该都是这个原因

ValueError: need at least one array to concatenate
RuntimeError: element 0 of tensors does not require grad and does not have a grad_fn

官方代码&教程
pytorch-grad-cam

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/zaji/5571622.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-12-14
下一篇2022-12-14

发表评论

登录后才能评论

评论列表(0条)

    保存