Deep Learning with PyTorch
Book
Code
Almost all of our example notebooks contain the following boilerplate in the first cell (some lines may be missing in early chapters)
%matplotlib inline from matplotlib import pyplot as plt import numpy as np import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim torch.set_printoptions(edgeitems=2) torch.manual_seed(123)
Convention
- Variables named with a
_t
suffix are tensors stored in CPU memory, - Variables named with a
_g
suffix are tensors in GPU memory - Variables named with a
_a
suffix are NumPy arrays.
- Variables named with a