#Learning objective


This chapter covers the basics of tensors in PyTorch. You’ll learn what tensors are, how to create them with various methods, and understand their different data types. We’ll also explore basic operations, how to get information from tensors, and manipulate their structure. Additionally, you'll discover how to run PyTorch on a GPU and test your knowledge with a quiz at the end.


1. What is a Tensor?
  • Understand the concept of tensors and their role in machine learning.

    tensor-overview
    /chapter-01/tensor-overview/

2. Creating Tensors in PyTorch

Discover how to create tensors in PyTorch using various methods. We will explore:

2.1. Tensors of Different Dimensions

  • Create 1D, 2D, and 3D tensors.

2.2. Random Tensors

  • Create tensors with random values and understand their use.

2.3. Zeros and Ones

  • Create tensors filled with zeros or ones and their applications.

2.4. Range and Shape-Matching Tensors

  • Create tensors with a range of values and tensors with shapes matching other tensors.

    creating-tensors
    /chapter-01/creating-tensors/

3. Tensor Datatypes
  • Understand the different data types for tensors and how to specify them.

    tensor-datatypes
    /chapter-01/tensor-datatypes/

4. Getting Information from Tensors
  • Learn how to retrieve key information about tensors, such as shape, data type, device, and dimensions.

    tensor-information
    /chapter-01/tensor-information/

5. Basic Tensor Operations and Aggregation
  • Explore basic arithmetic, matrix operations, and aggregation functions for tensors like sum, mean, max, min, norm, and count..

    tensor-operations-aggregation
    /chapter-01/tensor-operations-aggregation/

6. Reshaping, Stacking, Squeezing, and Unsqueezing Tensors
  • Learn how to manipulate the structure of tensors using reshaping, stacking, squeezing, and unsqueezing operations.

    reshape-stack-squeeze-tensors
    /chapter-01/reshape-stack-squeeze-tensors/

7. Getting PyTorch to Run on the GPU
  • Understand how to use the GPU for tensor operations and model training in PyTorch.

    run-pytorch-on-gpu
    /chapter-01/run-pytorch-on-gpu/

8. Exercices
  • Assess your understanding of the material.

    exercices
    /chapter-01/exercices/