본문 바로가기
728x90
반응형

Python286

[PyTorch] in-place 연산이란? in-place 연산이란?in-place 연산은 원본 데이터 구조를 직접 수정하여 별도의 복사본을 만들지 않는 연산 방식을 가리킴.메모리 효율성이 높지만,원본 데이터가 변경된다는 점을 주의해야 함.주의할 점은 in-place 연산을 사용할 때 자동 미분(autograd)에서 문제가 발생할 수 있음.requires_grad=True인 텐서에 대해 in-place 연산을 수행하면계산 그래프가 올바르게 유지되지 않을 수 있으므로 주의해야 함.autograd를 사용할 때는 in-place 연산을 피해야 함.즉, 모델 학습 중에는 in-place 연산을 사용하지 말 것.PyTorch에서의 in-place 연산PyTorch에서는 method 이름 끝에 언더스코어(_)를 붙여 in-place operation 임을 .. 2025. 3. 13.
[PyTorch] flattenning - Tensor's methods PyTorch에서 Multi-dimensional tensor 를 1차원(1D)으로 변환을 지원하는 여러 방법(주로 method.)이 있음.단순히 view를 제공하는지 아니면 복사본인지에 대한 이해가 필요함.NumPy의 ndarray의 경우는 다음을 참고:2024.09.09 - [Python] - [NumPy] ravel() 메서드 with flatten() 메서드 [NumPy] ravel() 메서드 with flatten() 메서드NumPy의 ndarray.ravel() 메서드는다차원 배열을 1차원 배열로 평탄화(flatten)하는 데 사용됨.기본적으로 이 메서드는 원본 배열의 데이터에 대한 뷰(view)를 반환: 즉 복사본을 생성하지 않고 메모리를ds31x.tistory.com1. tensor.vie.. 2025. 3. 13.
[PyTorch] tensor 생성 및 초기화, 기본 조작 참고로, NumPy에 대한 것은 다음을 참고:더보기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 imds31x.tistory.com0. tensor란?https://dsaint31.tistory.com/891 [ML] Tenso.. 2025. 3. 13.
[Ex] PySide6 설치하고 나서 간단히 테스트 할 수 있는 코드from PySide6.QtWidgets import QLabel, QApplicationimport sysapp = QApplication(sys.argv)widget = QLabel("test!")widget.resize(300, 200) # 창의 크기 설정 (너비, 높이)widget.show()sys.exit(app.exec()) 2025.02.11 - [Python/PySide PyQt] - [PySide6] Installing PySide6 (and Designer) on Windows (with Conda) [PySide6] Installing PySide6 (and Designer) on Windows (with Conda)기존에 conda 가상환.. 2025. 3. 11.
[Py] dis 모듈 - Python Python의 dis 모듈: 바이트코드 disassemble하기Python은 인터프리터 언어지만, 실행 전에 source code (원시코드)를 bytecode (바이트코드) 라는 중간 형태로 컴파일하여 성능을 향상시킴.이 바이트코드는 Python의 가상 머신(보통 CPython VM)에서 실행됨.이를 disassemble(역어셈블)하여 분석할 수 있게 해주는 도구가 표준 라이브러리의 dis 모듈임.2024.06.05 - [CE] - [CE] Bytecode (바이트코드) [CE] Bytecode (바이트코드)Bytecode (바이트코드)정의:Bytecode는 고수준 프로그래밍 언어로 작성된 source code를 중간 형태로 변환한 code 임.이는 특정 Virtual Machine (VM)에서 실행.. 2025. 3. 11.
[DL] Tensor 다루기 기초 - PyTorch 중심 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.comhttps://dsaint31.tistory.com/456 [Programming] Primitive Data Type : C, C++, NumPy, TorchPrimitive Data Type이(Unboxed type)란?C, C++, NumPy, PyTorch, TensorF.. 2025. 3. 7.
728x90
반응형