PyTorch is a popular Machine learning framework for Python. It provides Autograd and JIT compilation.
Tensor
The primary data type you use with PyTorch is the torch.Tensor. You can think of a tensor as an N-dimensional array.
You can turn a Python list into a PyTorch tensor using the torch.tensor
function.
import torch
x = torch.tensor([1, 2, 3])
Citation
If you find this work useful, please cite it as:
@article{yaltirakli,
title = "PyTorch",
author = "Yaltirakli, Gokberk",
journal = "gkbrk.com",
year = "2025",
url = "https://www.gkbrk.com/pytorch"
}
Not using BibTeX? Click here for more citation styles.
IEEE Citation Gokberk Yaltirakli, "PyTorch", August, 2025. [Online]. Available: https://www.gkbrk.com/pytorch. [Accessed Aug. 24, 2025].
APA Style Yaltirakli, G. (2025, August 24). PyTorch. https://www.gkbrk.com/pytorch
Bluebook Style Gokberk Yaltirakli, PyTorch, GKBRK.COM (Aug. 24, 2025), https://www.gkbrk.com/pytorch