dhwiii's notepad | 딥 러닝, 코덱 일기장

[파이썬 에러코드] invalid index of a 0-dim tensor. Use `tensor.item()` in Python or `tensor.item<T>()` in C++ to convert a 0-dim tensor to a number 본문

■ Working Draft/◎ 에러코드 일기장

[파이썬 에러코드] invalid index of a 0-dim tensor. Use `tensor.item()` in Python or `tensor.item<T>()` in C++ to convert a 0-dim tensor to a number

dhwiii 2021. 5. 9. 20:34

invalid index of a 0-dim tensor. Use `tensor.item()` in Python or `tensor.item<T>()` in C++ to convert a 0-dim tensor to a number

tensor에 관련된 오류이다. 

tensor.data[0]와 같이 되어있는 구조를 

tensor.item() 으로 바꾸어 주거나 [0]을 지워주도록 하자.

Comments