Tensors — PyTorch Tutorials 2.13.0+cu130 documentation
Learn the Basics || Quickstart || Tensors || Datasets & DataLoaders || Transforms || Build Model || Autograd || Optimization || Save & Load Model Created On: Feb 10, 2021 | Last Updated: Apr 30, 2026 | Last Verified: Nov 05, 2024 Tensors are a specialized data structure that are very similar to arrays and matrices. In PyTorch, we use tensors to encode the inputs and outputs of a model, as well as the model’s parameters. Tensors are similar to NumPy’s ndarrays, except that tensors can run on GPUs or other hardware accelerators. In fact, tensors and NumPy arrays can often share the same underlying memory, eliminating the need to copy data (see Bridge with NumPy). Tensors are also optimized for automatic differentiation (we’ll see more about that later in the Autograd section). If you’re familiar with ndarrays, you’ll be right at home with the Tensor API. If not, follow along! Tensors can be initialized in various ways. Take a look at the following examples: Directly from data Tensors can
Note Go to the end to download the full example code. Learn the Basics || Quickstart || Tensors || Datasets & DataLoaders || Transforms || Build Model || Autograd || Optimization || Save & Load Model Tensors # Created On: Feb 10, 2021 | Last Updated: Apr 30, 2026 | Last Verified: Nov 05, 2024 Tensors are a specialized data structure that are very similar to arrays and matrices. In PyTorch, we use tensors to encode the inputs and outputs of a model, as well as the model’s parameters. Tensors are similar to NumPy’s ndarrays, except that tensors can run on GPUs or other hardware accelerators. In
Explore this link on the map →related reading
- Tensors — PyTorch Tutorials 2.12.0+cu130 documentationpytorch.org
- PyTorch internals : ezyang's blogblog.ezyang.com
- torch.Tensor — PyTorch 2.12 documentationdocs.pytorch.org
- Learning PyTorch with Examples — PyTorch Tutorials 2.12.0+cu130 documentationpytorch.org
- PyTorch (@PyTorch) / Xx.com
- Tiny TPUtinytpu.com
- the bug that taught me more about PyTorch than years of using it | Elana Simonelanapearl.github.io
- 2404.17625arxiv.org
- Chapter 0: Fundamentals - ARENAlearn.arena.education
- The Tensor: The fundamental data structure of ML - DEV Communitydev.to
- Einops: Powerful library for tensor operations in deep learning | Oxford Protein Informatics Groupblopig.com
- Tensor Considered Harmfulnlp.seas.harvard.edu