leo.blog();

PyTorch

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])

Leave a Comment