TensorLearn
Back to Course
Deep Learning with PyTorch
Module 13 of 13

13. PyTorch Cheatsheet

Tensors

python
x = torch.zeros(3, 3) x = x.to("cuda") x.requires_grad = True

Training Loop

python
opt.zero_grad() loss.backward() opt.step()

IO

python
torch.save(model.state_dict(), "w.pt") model.load_state_dict(torch.load("w.pt"))

Mark as Completed

TensorLearn - AI Engineering for Professionals