# 關於 in place

RuntimeError: one of the variables needed for gradient computation has been modified by an inplace operation: [torch.FloatTensor [24, 1]], which is output 0 of ViewBackward, is at version 14; expected version 13 instead. Hint: the backtrace further above shows the operation that failed to compute its gradient. The variable in question was changed in there or anywhere later. Good luck!


with torch.autograd.set_detect_anomaly(True): 設定起來後，多顯示出來的出錯的部分卻指向一個再簡單不過的全連接層的 forward lgt = self.fc(cov_t)，把此行做各種排除還是沒有用。

x1 += k


x1 = x1 + k


#PyTorch #torch #Machine-Learning