An array is an n-dimensional data structure: a scalar has zero dimensions, a vector one, a matrix two, and higher-rank arrays more. In deep learning, arrays organize inputs, outputs, and network parameters. section 1.2
Write an array’s shape as an ordered tuple such as (B, C, W, H), or mathematically as ℝB,C,W,H. Dimension letters commonly describe batches, channels, widths, heights, or hidden outputs. section 1.2
Representing shapes in PyTorch
torch.tensor(3.14) has shape torch.Size([]); [1, 2, 3, 4] has shape torch.Size([4]); a four-by-two matrix has shape torch.Size([4, 2]); and a three-dimensional array can have shape torch.Size([4, 2, 3]). Arrays can also be converted from NumPy and sliced into row or column subvectors. section 1.2
Figure 1.4 Examples of tensors, with more dimensions or axes as we move from left to right. A scalar represents a single value. A vector is a list of values and is how we often think about one datapoint. A matrix is a grid of values and is often used for a dataset. A three-dimensional tensor can be used to represent a dataset of sequences.
Compare scalar, vector, matrix, and three-dimensional array shapes as dimensions increase. section 1.2







































