본문 바로가기
반응형

딥러닝/파이토치4

pytorch - RuntimeError: one of the variables needed for gradient computation has been modified by an inplace operation: [torch.cuda.FloatTensor [1, 512, 4, 4]] is at version 2; expected version 1 instead. Hint: enable anomaly detection to find the opera.. # 개발 환경 Pytorch Version : 1.7.0 # 오류 내용 RuntimeError: one of the variables needed for gradient computation has been modified by an inplace operation: [torch.cuda.FloatTensor [1, 512, 4, 4]] is at version 2; expected version 1 instead. Hint: enable anomaly detection to find the operation that failed to compute its gradient, with torch.autograd.set_detect_anomaly(True). # 해결 with torch.autograd.se.. 2021. 8. 28.
Pytorch - RuntimeError: one of the variables needed for gradient computation has been modified by an inplace operation: [torch.cuda.FloatTensor [1, 512, 4, 4]] is at version 2; expected version 1 instead. Hint: the backtrace further above shows the oper.. # 개발 환경 Pytorch Version : 1.7.0 # 오류 내용 RuntimeError: one of the variables needed for gradient computation has been modified by an inplace operation: [torch.cuda.FloatTensor [1, 512, 4, 4]] is at version 2; expected version 1 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 lu.. 2021. 8. 28.
Pytorch - Tensor To Image torch version : 1.7.0 import torchvision torchvision.utils.save_image( [이미지 텐서 변수], [저장 경로]) Ex) torchvision.utils.save_image( img_tensor, os.path.join(path_, 'test.jpg') ) 2021. 8. 28.
Pytorch - Tensor변수에서 값만 가져오기 ( item() 함수 ) Pytorch에서 tensor에 저장된 값만을 가져오는 방법. tensor변수에 .item() 을 붙이면 된다. 예) ten_val = torch.one() val = ten_val.item() # 텐서에서 값만을 가져온다. 2021. 6. 26.
반응형