torch

Python

[pytorch] transpose, permute 함수

pytorch로 permute 함수를 사용하다가 transpose랑 비슷한 것 같은데 정확히 차이를 모르고 있구나 싶어서 찾아보고 기록하기 위해 해당 포스트를 작성하게 되었다. ◾ permute() 먼저, permute 함수는 모든 차원을 맞교환 할 수 있는 함수로 차원을 교환하면서 contiguous한 성질이 사라진다는 특징이 있다. permute() 괄호 안에 인덱스들을 바꾸고자 하는 위치대로 적어주면 된다. x = torch.rand(1, 2, 3) x1 = x.permute(2, 1, 0) >> output [3, 2, 1] 위 예시에서는 기존에 0,1,2번 인덱스를 가진 [1,2,3]을 2,1,0번 인덱스 순서로 바꿔 [3,2,1]로 바꿔주었기 때문에 output이 [3,2,1]이 되는 것이다...

각종 에러들을 해결 해 보자

torch | attributeerror: 'upsample' object has no attribute 'recompute_scale_factor'

우분투를 다시 한번 싹- 밀고 날 것 그 자체의 환경에서 이전에 개발했던 객체 검출 모델을 사용한 코드의 동작 테스트를 진행하던 중 아래와 같은 에러를 마주했다. attributeerror: 'upsample' object has no attribute 'recompute_scale_factor' File /usr/local/lib/python3.8/site-packages/torch/nn/modules/upsampling.py:154, in Upsample.forward(self, input) 152 def forward(self, input: Tensor) -> Tensor: 153 return F.interpolate(input, self.size, self.scale_factor, self.mod..

토오오끼
'torch' 태그의 글 목록