목록transpose (2)
IT_World
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/kwV5i/btq59MQie1r/WLdthbe3SpoGhWRDtVOjK0/img.png)
RuntimeError: view size is not compatible with input tensor's size and stride (at least one dimension spans across two contiguous subspaces). Use .reshape(...) instead. 파이토치에서 Pytorch code를 돌리던 중 에러발생 x = x.view(x.size(0), -1) 에러 발생 위치는 그러다가 .contiguous() 를 앞에 붙이라는 글을 보게됐다. x = x.contiguous().view(x.size(0), -1) 무사히 돌아간다. RuntimeError: invalid argument 1: input is not contiguous at contiguous()손..
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/dU0msx/btq2bHY7gsR/TbOKELqKC4kM6TJQTe1aE1/img.png)
1. glob로 이미지를 불러오고 rotate로 이미지를 회전해보자. import os from PIL import Image import glob #이미지 폴더 불러오기 a= 1 path = f"/home//data/img/{a}" files = glob.glob(path + '/*') #없는 폴더 만들어주는 코드 make_path = f"/home/rotate/{a}" if not os.path.isdir(make_path): os.mkdir(make_path) # 저장 root 만들어주자 save_path = f"/home/rotate/{a}/" #폴더에 저장된 이미지 순차적으로 불러온다. for f in files: for idx, file in enumerate(files): fname, ext..