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
- NeRF paper
- NERF
- panoptic nerf
- Vae
- 2022
- 파이토치
- GAN
- Computer Vision
- 논문리뷰
- pytorch
- paper review
- Python
- IROS
- 논문
- 리눅스
- Semantic Segmentation
- Deep Learning
- docker
- Paper
- CVPR2023
- 딥러닝
- 논문 리뷰
- Neural Radiance Field
- linux
- panoptic segmentation
- CVPR
- 융합연구
- ICCV
- ICCV 2021
- 경희대
Archives
- Today
- Total
윤제로의 제로베이스
RuntimeError: element 0 of tensors does not require grad and does not have a grad_fn 본문
Issue board/python
RuntimeError: element 0 of tensors does not require grad and does not have a grad_fn
윤_제로 2023. 9. 25. 14:54pre trained model을 가져와서 일부 레이어에만 requires_grad=True로 해두었는데 loss를 계산하니 loss.backward() 부분에서 런타임 에러가 났다.
RuntimeError: element 0 of tensors does not require grad and does not have a grad_fn
아래와 같이 loss.requires_grad_(True)를 추가해주니 잘 돌아간다.
optimizer.zero_grad()
loss.requires_grad_(True) # 추가
loss.backward()
optimizer.step()
출처:
https://yjs-program.tistory.com/210
RuntimeError: element 0 of tensors does not require grad and does not have a grad_fn
RuntimeError: element 0 of tensors does not require grad and does not have a grad_fn 전체 네트워크 모델 중, 일부 레이어만 requires_grad = True로 셋팅했는데, 특정 구간에서 loss.backward()를 수행할 때, 다음과 같은 에러
yjs-program.tistory.com
'Issue board > python' 카테고리의 다른 글
폴더 생성 및 파일 리스트 (0) | 2023.02.24 |
---|---|
[Python OpenCV] src_depth != CV_16F && src_depth != CV_32S in function 'convertToShow' 해결 방법 (0) | 2023.02.24 |
Anaconda 가상환경 만들기 (0) | 2023.02.20 |