pytorch新的layer,debug梯度能否传过去

常常遇到诸如以下之类的问题

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

一种推荐的方式是经过新layer的变量,直接torch.sum(变量).backward(),看一下是否报错,每经过一层自己的layer,或者每经过一个操作,就可以做这种操作,如果不报错说明语法上是没有问题的,如果报错,说明语法就有问题

posted on 2021-12-28 19:48  YongjieShi  阅读(48)  评论(0编辑  收藏  举报

导航