Vision Transformer를 간단하게 구현해보자 patch단위로 sequence형태로 변형하여 image embedding, multi head attention, MLP 구조로 구현하려고 한다. 1. Setup import torch import torch.nn as nn from torch import Tensor import torchvision import torchvision.transforms as transforms from torch.utils.data import DataLoader import torch.optim as optim from einops import rearrange, repeat from einops.layers.torch import Rearrange, Redu..

Pytorch로 AlexNet을 간단하게 구현해보자 논문에서 제시한 AlexNet 구조보다 좀 더 간단하게 1 Flow로 11x11 Conv - 5x5 Conv - Pooling - 3x3 Conv - 3x3 Conv - 3x3 Conv - Pooling - fc 4096 - fc 4096 - classifier 구조로 구현해봤다. 1. Intro 1. 11x11 Conv stride = 4, padding = 0, out_channels = 96 논문은 48 + 48 두개로 split했으나 간단하게 1 flow로 구현 input size = 227(논문에서는 224지만 실제로 227로 구현해야 동작하여 transform Resize 활용해 적용) output size = 55 2. 5x5 Conv st..