Loading...
2023. 3. 11. 23:47

pytorch tensor 다루기 재활치료 2편 - view, squeeze, unsqueeze, type, cat, stack, ones_like, zeros_like, inplace -

1. view 원소의 수를 유지하면서 tensor의 크기를 변경하는 방법 numpy의 reshape와 같은 역할 t = np.array([[[0,1,2], [3,4,5]], [[6,7,8], [9,10,11]]]) ft = torch.FloatTensor(t) print(ft.shape) torch.Size([2, 2, 3]) 1-1) 이제 ft tensor를 view를 사용해서 2차원 tensor로 변경 print(ft.view([-1,3])) #ft라는 텐서를 (?,3)의 크기로 변경 print(ft.view([-1,3]).shape) tensor([[ 0., 1., 2.], [ 3., 4., 5.], [ 6., 7., 8.], [ 9., 10., 11.]]) torch.Size([4, 3]) vie..

2022. 8. 9. 01:54

문제의 핵심을 이해하고 정확히 구현하는 알고리즘

1. 문제 https://swexpertacademy.com/main/code/problem/problemDetail.do?contestProbId=AV134DPqAA8CFAYh&categoryId=AV134DPqAA8CFAYh&categoryType=CODE&problemTitle=view&orderBy=FIRST_REG_DATETIME&selectCodeLang=ALL&select-1=&pageSize=10&pageIndex=1 SW Expert Academy SW 프로그래밍 역량 강화에 도움이 되는 다양한 학습 컨텐츠를 확인하세요! swexpertacademy.com 강변에 빌딩들이 옆으로 뺵빽하게 밀집한 지역이 있다. 이곳에서는 빌딩들이 너무 좌우로 밀집하여, 강에 대한 조망은 모든 세대에서 좋지..