Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
Tags
- sigmoid
- overfitting
- Attention
- python practice
- Classificaion
- XOR
- neural net
- Self-loop attention
- word2vec
- Set Transformer
- sentence embedding
- Python
- pytorch
- Transformer
- abstraction
- machine learning
- deep learning
- NLP
- GNN
- elif
Archives
- Today
- Total
Research Notes
[Solved] IndexError: invalid index of a 0-dim tensor. Use tensor.item() to convert a 0-dim tensor to a Python number 본문
Programming Language/Python
[Solved] IndexError: invalid index of a 0-dim tensor. Use tensor.item() to convert a 0-dim tensor to a Python number
jiachoi 2022. 9. 22. 11:18문제상황: pytorch에서 model을 돌리다가 해당 에러가 뜸
이유: pytorch 이전 버전(0.5)에서 작성된 코드를 돌릴 때 뜨는 에러, pytorch의 데이터 자료 구조가 변경되었다고 함
코드에서 변수명.data[0] --> 변수명.data로 바꾸면 해결됨
'Programming Language > Python' 카테고리의 다른 글
[Python] Data Type: Integer, Float, String, and Formatting (0) | 2023.07.03 |
---|---|
[Python] Python Installation in Mac OS (0) | 2023.07.03 |
[Python] Virtual Environment Generation Reference (0) | 2022.08.04 |
[Solved] 'RuntimeError: CUDA out of memory.' (0) | 2022.04.27 |
[Solved] TypeError: an Integer is required (got type bytes) (0) | 2022.04.23 |