处理 Runtime Error: one of the variables needed for gradient computation has been 心中带点小风骚 2 年前 两次遇到这个问题,记录一下1、反向传播时报错,参考 在用pytorch跑生成对抗网络的时候,出现错误Runtime Error: one of the variables needed for gradient computation has been_qq_33093927的博客-CSDN博客最近在看GAN,遇到了些问题,发现是前人踩过的坑,确实帮到了我,集中整理下吧目录问题环境配置解决过程总结问题在用pytorch跑生成对抗网络的时候,出现错误Runtime Error: one of the variables needed for gradient computation has been modified by an inplace operation,特记录排坑记录。环境配置windows10 2004python 3.7.4pytorch 1https://blog.csdn.net/qq_33093927/article/details/124063916?spm=1001.2101.3001.6650.5&utm_medium=distribute.pc_relevant.none-task-blog-2%7Edefault%7EBlogCommendFromBaidu%7ERate-5-124063916-blog-125728708.pc_relevant_recovery_v2&depth_1-utm_source=distribute.pc_relevant.none-task-blog-2%7Edefault%7EBlogCommendFromBaidu%7ERate-5-124063916-blog-125728708.pc_relevant_recovery_v2&utm_relevant_index=6核心就是把optimizer.step()挪到梯度计算的后面2、反向传播前的计算报错,参考里面第三点Pytorch报错:one of the variables needed for gradient computation has been modified by an inplace operation – lzp的bky – 博客园其中使用一个pytorch写的模型时,报错:RuntimeError:one of the variables needed for gradient computation has been modifhttps://www.cnblogs.com/liangzp/p/9207979.html 文章出处登录后可见! 立即登录 已经登录?立即刷新