PyTorch Tensors and Autograd
torch.Tensor, requires_grad, backward(), gradient computation, tensor operations.
What is PyTorch?
PyTorch is a deep learning framework built around tensors, multi-dimensional arrays with GPU acceleration and automatic differentiation. The two pillars you must master first are tensors and autograd.
pip install torch
import torchCreating Tensors
A tensor is like a NumPy array but can live on a GPU and track gradients. Create one with torch.tensor. Tensors have a shape and a dtype.
x = torch.tensor([1.0, 2.0, 3.0])
print(x.shape) # torch.Size([3])
print(x.dtype) # torch.float32All lessons in this course
- PyTorch Tensors and Autograd
- Custom Datasets and DataLoaders
- Building and Training CNNs in PyTorch
- Object Detection with YOLOv8