본문 바로가기
라이브러리 개요 및 설치 가이드

[PyTorch] 개요 및 설치 가이드

by First Adventure 2025. 5. 28.
반응형

소개

  PyTorch는 메타(Facebook)에서 개발한 오픈소스 딥러닝 라이브러리로, 직관적이며 유연한 텐서 연산과 GPU 가속, 자동 미분을 지원하여 빠른 프로토타이핑 및 연구 개발에 널리 사용됩니다.

 

설치 방법

# 기본 설치 (CPU 전용)
pip install torch torchvision torchaudio

# GPU 지원 설치 (CUDA 12.1 예시)
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121

 

설치 확인

import torch
print(torch.__version__, torch.cuda.is_available())

 

관련 내용

  PyTorch 공식 홈페이지

  PyTorch 자주 쓰이는 함수 모음

 

[PyTorch] 함수 목차

1. Tensor 생성 및 변환 torch.flatten(): 텐서를 1차원으로 평탄화torch.stack(): 텐서를 새로운 차원에 쌓기torch.cat(): 텐서들 연결torch.unsqueeze(): 텐서의 차원을 추가torch.squeeze(): 텐서에서 크기가

python.realjourney.co.kr

 

 

반응형