본문 바로가기

기타

Pytorch GPU device 쓸 때 디버깅 오류

https://stackoverflow.com/questions/51009687/pytorch-unable-to-get-repr-for-class-torch-tensor

 

Pytorch, Unable to get repr for <class 'torch.tensor'="">

I'm implementing some RL in PyTorch and had to write my own mse_loss function (which I found on Stackoverflow ;) ). The loss function is: def mse_loss(input_, target_): return torch.sum( ...

stackoverflow.com

ㅋㅋㅋ

무슨 일이 있었냐면, BERT pretrain 코드를 짜는데

line 195에 오류가 있는데 그냥 에러 없이 돌아가놓고 line 197에서 이유를 알 수 없는 에러가 남ㅋ 

device-side assert라고.

근데 이걸 디버깅하려면 device를 CPU로 바꾸어야 오류 원인이 정확히 에러 메세지로 뜸.