pytorch의 tensor는 넘파이의 ndarray와 유사하게 구현되었다고 하며, 차이점은 (1) GPU에서 연산을 수행할 수 있으며 (2) Autograd 계산에 최적화되어있다는 것이다.
if torch.cuda_is_available():
tensor = tensor.to('cuda')
이런식으로 GPU로 옮겨주고,
tensor = tensor.to('cpu')
이렇게 CPU로 옮겨준다.
https://tutorials.pytorch.kr/beginner/basics/tensorqs_tutorial.html
CNN parameter 계산 관련 참고할만한 블로그 (1) | 2024.09.04 |
---|---|
(pytorch) pytorch-tensor와 numpy-ndarray 간에 변환하기 (0) | 2024.09.04 |
PyTorch (1) Dataset, DataLoader (0) | 2024.07.29 |
pytorch - Linear layer의 datatype (0) | 2024.04.06 |
댓글 영역