Pytorch Basic Tensor Manipulation 1

Jacob Kim·2023년 12월 30일
0

Deeplearning

목록 보기
1/1
post-thumbnail

Contents

1) Vector, Matrix and Tensor

2) NumPy Review

3) Pytorch Tensor Allocation

4) Matris Multiplication

5) Other Basic Ops

Vector, Matrix and Tensor

Pytorch Tensor Shape Convention

2D Tensor(Typical Simple Setting)

tensor = batch size X dim
t = (batch size, dim)

Computer Vision에서 쓰이는 3D Tensor의 의미

tensor = batch size X width X height
batch size : 3 dimensional box 앞 사각형의 세로를 의미한다.
width : 3 dimensional box 앞 사각형의 가로를 의미한다.
height : 3 dimensioal box에서 윗 사각형의 세로를 의미한다

Natural Language Processing에서 쓰이는 3D Tensor의 의미

tensor = batch size X length X dim
batch size : 3 dimensional box 앞 사각형의 세로를 의미한다.
length : 3 dimensional box 앞 사각형의 가로를 의미한다.
dim : 3 dimensioal box에서 윗 사각형의 세로를 의미한다
dimbatch size만큼 스택이 쌓여서 3 dimensional box를 이룬다고 생각하면 된다.

Import

Run pip install -r requirements.txt in terminal to install all required Python packages

import numpy as np
import torch

NumPy Review

1D Array with NumPy

t = np.array([])

Reference https://github.com/deeplearningzerotoall/PyTorch
모두를 위한 딥러닝 시즌 2 강의 내용 참조

profile
AI, Information and Communication, Electronics, Computer Science, Bio, Algorithms

0개의 댓글

관련 채용 정보