LESSON 6.01 · 6 STAGES · 3 CONTROLS · 3 CHECKSPRO · PREVIEW
Tensors, views and strides
Watch one row of memory become a grid, a transpose and a GPU copy.
Pro lesson. Stage 1 is free to watch. Pro opens all 6 stages, 3 controls and 3 checks, in this lesson and every other.
Go Pro · $8.25/moEXPLAINER · 6.01 · TENSOR BAY12 NUMBERS · INT64 · 96 BYTES
01
Stage 1 of 6 · Storage
torch.arange(0, 120, 10) writes 12 numbers into one row of memory. That row is the storage.
Explain it simply
Every tensor keeps its numbers in one long row of memory, called its storage. Here there are 12 numbers, 0 to 110 in steps of 10. Each is an int64 of 8 bytes, so the row takes 96 bytes. Other makers like zeros or rand fill a new storage the same way.
12 storage cells hold 0 to 110 in steps of 10. Offsets 0 to 11 sit under the cells. The tensor t has shape (12,) and stride (1,).
storage and xshape, strides, offsetviews and copiesa jump no stride fitsa view's cells
Toy: 12 int64 numbers · PyTorch 2 rules · GPU copy drawn, not run
MATH · STAGE 1HOVER A SYMBOL OR A SHAPE
Each number sits 8 bytes after the number before it.
PRO LESSON · YOU WATCHED STAGE 1 OF 6
Unlock the full explainer
- 5 more stages and 3 live controls
- 2 mix-up cards and 3 predict-then-reveal checks
- Watch it as a narrated video, in three voices
- Every Pro lesson and capstone · 656 in total
$99 a year, or $15 a month. Cancel any time.