Machine Learning Fundamentals · free preview

Tensors and Shape

A model's data lives in arrays whose axis lengths are called the shape, and shape arithmetic decides whether a computation is defined.

1. Arrays with an arbitrary number of axes

Arrays with an arbitrary number of axes

2. Elementwise operations

Elementwise operations

3. Combining tensors across axes

Combining tensors across axes

4. What the shape tuple means

A dataset holds 200 photographs, each stored as three color channels of 32 rows and 32 columns. The batch tensor passed to a model has shape (200,32,32,3)(200, 32, 32, 3). How many numbers does the tensor hold, and which axis length corresponds to the batch?

5. Summing away an axis

A tensor of shape (3,4)(3, 4) is summed over axis 11. The result is a vector of shape ____.

Practice this interactively

Free account · instant grading · spaced review that schedules itself.

Start this course for free