본문 바로가기
Python

[DL] Tensor 다루기 - PyTorch 중심

by ds31x 2025. 3. 7.

 

https://dsaint31.tistory.com/891

 

[ML] Tensor: Scalar, Vector, Matrix.

Tensor 종류1. Scalar (0차원 tensor)하나의 숫자로 표현되는 가장 기본적인 형태.크기(magnitude)만을 가지며 방향은 없음.예시: 온도(25°C), 나이(20), 가격(1000원)# 파이썬/NumPy에서의 표현scalar = 5.02. Vector (

dsaint31.tistory.com

https://dsaint31.tistory.com/456

 

[Programming] Primitive Data Type : C, C++, NumPy, Torch

Primitive Data Type이(Unboxed type)란?C, C++, NumPy, PyTorch, TensorFlow 등에서 사용되는numeric data type들은보통 unboxed type 이라고도 불리는 primitive data type들이다.unboxed type에서는할당된 메모리 bit들이 해당 numeri

dsaint31.tistory.com

2024.03.15 - [Python] - [DL] Tensor 객체의 attributes: ndim, shape, dtype

 

[DL] Tensor 객체의 attributes: ndim, shape, dtype

Class들Python에서Tensor 를 추상화하는 대표적인 class는 다음과 같음.NumPy의 ndarray: numpy.arrayPyTorch의 tensorTensorflow의 constant대표 Attributes이들의 대표적인 attributes는 다음과 같음.dtype: the datatype of elementn

ds31x.tistory.com

 

2025.03.13 - [Python] - [PyTorch] 생성 및 초기화, 기본 조작

 

[PyTorch] 생성 및 초기화, 기본 조작

NumPy에 대한 것은 다음을 참고:2024.09.09 - [Python] - [NumPy] 생성 및 초기화, 기본 조작 (1) [NumPy] 생성 및 초기화, 기본 조작 (1)1. ndarray 생성하기 (=tensor생성하기)np.array ( seq [,dtype])list 나 tuple 등의 seque

ds31x.tistory.com

 

 

2024.03.29 - [Python] - [DL] Tensor: Random Tensor 만들기 (NumPy, PyTorch)

 

[DL] Tensor: Random Tensor 만들기 (NumPy, PyTorch)

Tensor: Random Tensor 만들기 (NumPy, PyTorch)Random value를 얻는데 이용되는 Probability Distribution에 따라 크게 2가지로 나눌 수 있음.Uniform DistributionNormal Distribution 0. Uniform DistributionRandom Variable이 가질 수

ds31x.tistory.com

2024.03.21 - [Python] - [DL] Storage: PyTorch 텐서를 위한 메모리 관리

 

[DL] Storage: PyTorch 텐서를 위한 메모리 관리

Storage는 Tensor 인스턴스의 실제 데이터가 저장되는 1D Numerical Array를 관리함. 여러 Tensor 인스턴스들이 같은 storage를 공유할 수 있음. Storage는 memory에서 contiguous data block를 관리하며, 컴퓨터의 memory

ds31x.tistory.com

2024.03.15 - [Python] - [DL] Tensor: dtype 변경(casting) 및 shape 변경.

 

[DL] Tensor: dtype 변경(casting) 및 shape 변경.

Tensor를 추상화하고 있는 class로는numpy.array: numpy의 ndarraytorch.tensortensorflow.constant: (or tensorflow.Variable)이 있음. 이들은 Python의 sequence types과 달리 일반적으로 다음과 같은 특징을 지님.데이터들이

ds31x.tistory.com

 

2025.03.13 - [Python] - [PyTorch] flatenning - Tensor's methods

 

[PyTorch] flatenning - Tensor's methods

PyTorch에서 Multi-dimensional tensor 를 1차원(1D)으로 변환을 지원하는 여러 방법(주로 method.)이 있음.단순히 view를 제공하는지 아니면 복사본인지에 대한 이해가 필요함.NumPy의 ndarray의 경우는 다음을

ds31x.tistory.com

 

 

2024.03.15 - [Python] - [DL] Tensor 간의 변환: NumPy, PyTorch, TensorFlow

 

[DL] Tensor 간의 변환: NumPy, PyTorch, TensorFlow

pytorch와 numpy의 경우, 텐서를 추상화하고 있는 tensor와 ndarray 를 제공하며, 이 둘은 zero-copy interoperability를 가진다고 말할 수 있을 정도로 상호호환이 가능하다. TensorFlow도 numpy와 상당히 연관되어

ds31x.tistory.com


참고

2024.09.09 - [Python] - [NumPy] 생성 및 초기화, 기본 조작 (1)

 

[NumPy] 생성 및 초기화, 기본 조작 (1)

1. ndarray 생성하기 (=tensor생성하기)np.array ( seq [,dtype])list 나 tuple 등의 sequence 객체로부터 ndarray 생성.dtype : data type of element.float64 : default type in the numpy. *uint8 : unsigned int (8bit), the most commonly used for im

ds31x.tistory.com

 

'Python' 카테고리의 다른 글

[Ex] PySide6  (0) 2025.03.11
[Py] dis 모듈 - Python  (1) 2025.03.11
[Py] How to Install Python on Windows from Python.org  (0) 2025.03.06
[PyTorch] torchvision.transform 사용법  (0) 2025.01.12
[Py] io.StringIO 와 io.BytesIO  (0) 2024.12.03