'pytorch' 태그의 글 목록 — 뚝딱이

pytorch

기타/Docker

도커 인공지능 환경 구성 - NVIDIA/torch

GPU https://pasongsong.tistory.com/429 도커 GPU 설정하기 Nvidia Toolkit docker 19.*.* 부터 nvidia-docker가 아닌 nvidia-container-runtime를 설치하면 GPU인식 및 활용이 가능하다. https://docs.docker.com/config/containers/resource_constraints/#gpu docker-24.0.7 nvidia-container-runtime 설치 $ sudo apt-get ins pasongsong.tistory.com 그 전에 도커 gpu먼저 설정해야한다. torch image https://hub.docker.com/ Docker Hub Container Image Library | A..

Python/numpy & Pytorch

[Pytorch] tensor 합치기는 방법 cat(), stack()

'+' 연산자 list list에서는 '+' 연산자를 쓰면 list가 합쳐진다. x = [1,2] x2 = [3,4] x+x2 [1, 2, 3, 4] Tensor tensor는 합쳐지지 않고 각 원소마다 더해진다. 이는 같은 차원끼리 더하거나 한 차원이 1일 때만 가능함 x = torch.randint(0, 10,(3,1)) x2 = torch.randint(0, 10,(3,1)) x3 = torch.randint(0, 10,(1,1)) x, x2, x+x2, x+x3 tensor([[4], [2], [1]]) tensor([[2], [1], [2]]) tensor([[6], [3], [3]]) tensor([[5], [3], [2]]) x = torch.randint(0, 10,(3,1)) x2 = t..

기타/etc

[Pytorch] Summary 사용하기

Module from torchsummary import summary 모델 구조 class CNN(nn.Module): def __init__(self): super(CNN, self).__init__() self.conv1 = nn.Conv2d(1, 32, 3, 1) self.conv2 = nn.Conv2d(32, 64, 3, 1) self.dropout1 = nn.Dropout2d(0.25) self.dropout2 = nn.Dropout2d(0.5) self.fc1 = nn.Linear(9216, 128) self.fc2 = nn.Linear(128, 10) def forward(self, x): x = self.conv1(x) x = F.relu(x) x = self.conv2(x) x = F...

Python/numpy & Pytorch

Pytorch Cuda CuDNN 설정하기

TORCH torch version = 1.10.0에서 GPU 설정하기 https://pytorch.org/ 난 pip로 깔았으나 conda를 사용하는 사람은 conda 누르고 깔면 됨. 아래를 terminal에 깔아준다. ' pip3 install torch==1.10.0+cu102 torchvision==0.11.1+cu102 torchaudio===0.10.0+cu102 -f https://download.pytorch.org/whl/cu102/torch_stable.html ' https://pytorch.org/get-started/previous-versions/ PyTorch An open source machine learning framework that accelerates the pa..

파송송
'pytorch' 태그의 글 목록