RuntimeError: one of the variables needed for gradient computation has been modified by an inplace operation: [torch.cuda.FloatTensor [1, 100]], which is output 0 of UnsqueezeBackward0, is at version 5040; expected version 5039 instead.

错误分析:

由于pytorch升级到pytorch0.4之后,与之前pytorch0.3的用法发生来了一些变化,比如最重要的在pytorch0.4中将Tensor与Variance都组合成了同一个东西,pytorch0.4不再支持inplace操作。

解决方法:

1.把所有的inplace=True改成inplace=False
2.将loss+=new_loss这样所有的+=操作,改成loss=loss+new_loss
3.将pytorch版本回退到0.3,或者添加一个pytorch0.3的环境。

错误处理:one of the variables needed for gradient computation has been modified by inplace operation相关推荐

  1. 【Pytorch】RuntimeError: one of the variables needed for gradient computation has been modified by

    0.前言 最近在用Pytorch训练网络的时候出现了一个奇怪的错误,找了很久在偶然间试出了解决方法,因此记录一下,以作备忘.但具体原理还不是很清楚,也请各位大佬指教. 1.错误 RuntimeErro ...

  2. PyTorch报错“RuntimeError: one of the variables needed for gradient computation has been modified by……”

    1 问题描述 今天在写作DeepLabV3+的代码时,遇到了一个问题, 程序报错: RuntimeError: one of the variables needed for gradient com ...

  3. 解决一个GAN训练过程中的报错:one of the variables needed for gradient computation has been modified by an inplace

    跑一个GAN DEMO , 运行时出错. 出错代码: RuntimeError: one of the variables needed for gradient computation has be ...

  4. 排坑日记1:RuntimeError: one of the variables needed for gradient computation has been modified

    问题描述 在使用Pytorch复现DeepFill V1时,报如下错: RuntimeError: one of the variables needed for gradient computati ...

  5. one of the variables needed for gradient computation has been modified by an inplace operation

    参考:https://www.cnblogs.com/liangzp/p/9207979.html 使用一个pytorch写的模型时,报错:RuntimeError:one of the variab ...

  6. one of the variables needed for gradient computation has been modified by an inplace

    one of the variables needed for gradient computation has been modified by an inplace 参考:https://blog ...

  7. variables needed for gradient computation has been modified by an inplace operation

    one of the variables needed for gradient computation has been modified by an self.conf加了cuda()之后就成这样 ...

  8. RuntimeError: one of the variables needed for gradient computation has been modified by an inplace o

    RuntimeError: one of the variables needed for gradient computation has been modified by an inplace o ...

  9. RuntimeError: one of the variables needed for gradient computation has been modified by an inplace

    报错: RuntimeError: one of the variables needed for gradient computation has been modified by an inpla ...

最新文章

  1. R语言rpartb包树回归模型构建:基于前列腺prostate数据集
  2. python中分支结构与c语言中有何区别_C语言的分支语句有哪几种?C语言分支结构的基本形式是什么,区别是什么?...
  3. Linux中查看正在使用的端口并强制删除占用端口
  4. 白鹭 修改底层 egret.js 库后再次编译 成 新的库
  5. 单击GridView进入编辑模式
  6. 一个获取a标签传值的函数
  7. 不显示调用super_让不懂编程的人爱上iPhone开发(2017秋iOS11+Swift4+Xcode9版)-第11篇
  8. 从“她经济”到“TA经济“——美妆行业营销报告
  9. p2psearcher2013源码实现原理
  10. ListViewAdapter
  11. 笔记本通过网口控制单片机_国产又推出笔记本:旋转屏,自带RS-232串口和网口,工程师专用...
  12. 显示部分x_i5 9400F+GTX 1030+23.8英寸,攀升迁跃者X上手简评
  13. 感谢大家对课程的关注和喜爱
  14. 群晖docker安装Transmission下载器
  15. 讯飞tts语音引擎_讯飞iFLYOS语音让家居产品更智能
  16. 大数据对于企业的价值,主要体现在哪几个方面?
  17. 计算机cmos参数的设置,设置CMOS参数让电脑从光驱启动
  18. 小猪佩奇的4种python玩法,带你趣味学python!
  19. python的py、pyc、pyo、pyd文件区别
  20. linux c thread,Linux C 多线程

热门文章

  1. 韩国讨论到 2020 年拥抱开源操作系统
  2. [唐诗]182宫中行乐词(其一)-李白
  3. 使用参数化SQL语句进行模糊查找
  4. win32中GBK、UTF8的互转
  5. 解决ASP.NET AJAX在frame及iframe中跨域访问的问题
  6. SVN中update to revision与revert to revision的区别
  7. python+scapy 抓包与解析
  8. CSP认证201412-3 集合竞价[C++题解]:枚举、结构体
  9. 计算机一级讲评,一级WPS Office——全国计算机等级考试专家讲评
  10. html特殊文字效果,HTML几个特殊的属性标签的使用介绍