Chapter 1
Tensors, Batches, and Shapes
Arrays, axes, batch dimensions, feature dimensions, and the shape habits used by neural networks.
What this chapter does
Before a network can learn, data must have shape. This chapter teaches how to read tensors as organized numbers, distinguish batches from features, and predict basic layer output shapes.
Lessons
Read these in order.
Start with the chapter introduction, then move through the topic lessons. The order is chosen so each page can reuse ideas from the pages before it.
- 01Introduction
Why shape reasoning belongs at the beginning of Deep Learning.
- 02Scalars, Vectors, Matrices, and Tensors
Arrays as organized numbers, with shape as part of the meaning.
- 03Batch and Feature Dimensions
How examples and features appear in the shapes used by neural layers.
- 04Shape Notation and Axis Conventions
How to read tensor shapes by naming each axis before trusting the numbers.
- 05Reshaping and Flattening
Changing array shape while preserving the number of entries.
- 06Broadcasting
Reusing smaller arrays across compatible axes, especially for bias terms.
- 07Parameters, Activations, and Outputs as Tensors
The tensor roles that appear inside a neural network computation.
- 08Shape Debugging
Tracing expected and actual shapes to find the first mismatch.
Review and practice
Close the chapter deliberately.
Use the conclusion and revision notes before the chapter exercises. Hints and solutions are collected here, while lesson-level exercises reveal their own help inline.
What Chapter 1 established and how it prepares later neural layers.
Summary and Revision NotesA compact review of tensors, batches, features, and shapes.
ExercisesChapter-level practice for tensor and batch shape reasoning.
HintsLow-spoiler nudges for the Chapter 1 exercises.
SolutionsExplained solutions for the Chapter 1 exercises.
Before moving on
- Read scalar, vector, matrix, and tensor shapes.
- Distinguish batch dimensions from feature dimensions.
- Predict the output shape of a basic linear layer.
- Catch simple shape mismatches before reaching for a framework error.
Where this leads
- Models as Functions
- Linear Models and Scores
- Activation functions
- Loss functions