RuntimeError: one of the variables needed for gradient computation has been modified by an inplace operation: [torch.cuda.FloatTensor [1, 32, 22, 256, 256]], which is output 0 of ReluBackward1, is at version 3; expected version 2 instead. Hint: enable anomaly detection to find the operation that failed to compute its gradient, with torch.autograd.set_detect_anomaly(True).
出现了这个错误怎么办
一般可以尝试 将数据保存为tensor格式的形式 比如
img=torch.tensor(img)