type
status
date
slug
summary
tags
category
icon
password

mmdetection训练报错汇总

  • one of the variables needed for gradient computation has been modified by an inplace operation
    • 详细报错信息
      • 问题分析: 所谓inplace操作就是直接修改地址上的值。
        • 首先是torch中所有加 _ 的函数,x.squeeze(),x.unsqueeze()。这些操作直接修改变量,不返回值。
          其次一些函数可以通过设置是否inplace,比如Pytorch中 torch.relu()和torch.sigmoid()等激活函数不是inplace操作,其中ReLU可通过设置inplace=True进行inplace操作。
          以及一些算术操作,x += res是inplace操作,x = x + res不是。以及一些赋值操作。
          如果一些用于backward的值被inplace操作修改了就会报错,所以最好不使用inplace操作,以及将赋值操作放在各种需要计算梯度运算之前,gather要在赋值之后。
    • 解决方案: 将ReLuinplace=True移除
     
     
    自动生成文章永久链接基于Vdoing博客搭建记录
    Ghlerrix
    Ghlerrix
    山高水长,怕什么来不及,慌什么到不了。
    公告
    type
    status
    date
    slug
    summary
    tags
    category
    icon
    password
    这是新版的博客,想要访问旧版页面请使用以下链接。