one of the variables needed for gradient computation has been modified by an
self.conf加了cuda()之后就成这样了。
这个变量不求导
self.conf_mask = torch.zeros(batch_size,self.num_anchors,g_dim, g_dim, requires_grad=False).cuda()
错误代码:
self.conf_mask[...] = 0
正确做法:
self.conf_mask.cpu()[...] = 0