Skip to content
Reading as a guest: progress is saved in this browser. Create a free account and we’ll carry your progress over.

Foundations: Tensors & Data

Mission Map
1 / 6 · Briefing
SECTOR foundations · MISSION 2 · 18 min · 1 exercise

Understanding Tensor Shapes

INT. - ARCHIMEDES, LAB
In the signal lab, Farah studies holo grids that carve a flat data ribbon into candidate layouts, the same waveform echoing at two scales.

Dr. Farah analyzes the dimensional structure of the incoming data.

ARCHIMEDES SENSOR LOG · STREAM 7-G · Repeating structure detected at two distinct scales. Dimensional layout: unresolved. ARIA parse status: failed, 4,096 of 4,096 rules.

Dr. Farah

That log line is the most interesting thing on this ship. The stream isn't a wall of numbers; it has structure. Before we analyze anything, I want to know its dimensional layout.

Every has a : a tuple of numbers describing how many elements exist along each . If you've ever checked array.length or calculated rows × cols for a grid layout, you already think in shapes.

The Wrong Kind of Sixty-Four

Farah has a candidate layout for the stream: [450, 64], meaning 450 readings by 64 channels. The plotter needs one row per channel, shape [64, 450]. Demir reaches for reshape. Will each channel's values stay together?

Work it out on a small packet first. Each input row is a time step; each column is one channel. The numbers mark positions so you can follow exactly where they move.

The axis names explain the result: input[time][channel] must become output[channel][time]. A transpose swaps those axes. A reshape changes row lengths while preserving flat order. Both can produce the requested dimensions, so checking shape alone cannot catch this mistake.

Read Other Shapes

A list of ten values has shape [10]. A of 32 RGB images can have shape [32, 224, 224, 3]: examples, height, width, and color channels. A batch is a group of examples processed together. Record these axis meanings; the dimensions alone cannot tell you what the data represents.

For later in the course, [32, 5, 3] means 32 windows, five time steps in each, and three per step. The same indexing discipline applies: decide what each axis means before transforming the data.

Challenge

Reshape a flat tensor into a matrix.