Learn practical skills, build real-world projects, and advance your career
Created 4 years ago
##PyTORCH BASICS
Tensors & Gradients
I am going to show you a short introduction about PyTorch and about the it's functions.
- Torch
- Regression
- Mean Absolute Error
- Binary Classification
- Mean Squared Error
# Import torch and other required modules
import torch
torch
PyTorch is a library for processing tensors.
A tensor is a number, vector, matrix or any n-dimensional array.
# Example 1 - working (change this)
x= torch.tensor([[1, 2], [3, 4.]])
x
tensor([[1., 2.],
[3., 4.]])
Tensors can have any number of dimensions, and different lengths along each dimension.
We can inspect the length along each dimension using the .shape property of a tensor.