Notice
Recent Posts
Recent Comments
Link
«   2025/12   »
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 more
Archives
관리 메뉴

프랙티스만이 살길. 프랙티스만이 살길.

2 - 1. grad can be implicitly created only for scalar outputs 오류 해결 본문

pytorch

2 - 1. grad can be implicitly created only for scalar outputs 오류 해결

gaussian-goodman

다음과 같은 코드를 수행하다 grad can be implicitly created only for scalar outputs라는 에러 메시지를 받았습니다.

이는 마지막 z의 값이 스칼리 값이 아닌 벡터인 tensor라서 발생하는 오류입니다. 그러므로 z를 스칼라 값이 될 수 있게 만들어준 후 수행하면 됩니다.

mean을 이용해 스칼라 값으로 바꿔주겠습니다.

'pytorch' 카테고리의 다른 글

4. Torchvision, torchvision.transforms  (0) 2023.05.27
3. nn & nn.funtional  (0) 2023.05.27
2. AUTOGRAD  (0) 2023.05.27
1. Tensor  (0) 2023.05.25