PyTorch Study
-
[PyTorch Study]Tensor 자료형 사이즈 및 차원 변경2) Tech 2020. 9. 23. 09:04
PyTorch Study 세번째 시간입니다!! 지난 게시물에 이어 Pytorch Tensor 자료형 응용 2번째 시간입니다. 1. Tensor 자료형 사이즈 변경 # pytorch reshape, view 사용법 import torch t1 = torch.tensor([1,2,3,4,5,6]) print( t1, '\n') t2 = t1.view(2, 3) print( t2, '\n') print( t1.reshape(2,3), '\n') 위 코드의 출력을 보시면 reshape, view 의 역할이 감이 오실겁니다! - torch.tensor().reshape, view : Tensor 자료형의 사이즈 및 차원 변경시 사용 굉장히 많이 사용되므로 사용법을 잘알아 두셔야합니다. 이번에는 차원변경 예시를 함..
-
[PyTorch Study]Tensor 자료형 연산2) Tech 2020. 9. 23. 08:18
PyTorch Study 두번째 시간입니다!! 오늘은 Pytorch Tensor 자료형 연산에 대해 알아보겠습니다. tensor 자료형 연산은 numpy ndarray 연산과 유사한점이 굉장히 많습니다. 1. tensor 자료형 연산 # 덧셈 뺄셈, 제곱 import torch t1 = torch.tensor([1,2,3]) t2 = torch.tensor([5,6,7]) t3 = t1+10 t4 = t1 - t2 print(t3, '\n') print(t2**2) print('\n', t4) 보시면 tensor 자료형으로 덧셈, 뺄셈, 제곱 연산이 가능합니다. # Broad casting t1 = torch.tensor([1,2,3]) t5 = torch.tensor([[10, 20, 30], [40,..
-
[PyTorch Study] PyTorch 설치, 변수 선언 및 data type2) Tech 2020. 9. 22. 08:21
정말 오랜만에 블로그 글을 씁니다..! pytorch study를 하게되었는데, 복습할겸 공부 내용을 블로그에 적어보려합니다! 먼저 pytorch Library를 설치합시다! 1. Pytorch 설치 방법 pytorch.org/get-started/locally/ PyTorch An open source deep learning platform that provides a seamless path from research prototyping to production deployment. pytorch.org 위 링크에 접속해서 자신의 개발환경에 맞도록 선택해주면 'Run this Command' 란에 pytorch install 명령어가 생성됩니다! 설치 방법은 매우 간단하죠?! 2. Pytorch 시..