Skip to content
BENIBIX Learn

Tensor

General🔢 Math & StatisticsLinear Algebra

Also known as Tensor (Machine Learning)

A block of numbers. A photo is one, with height, width and colour.

Think of it like

Think of it like a pile of grids. Each one sits on the next, like pages in a book.

Example

Lucy's photo is 200 pixels high and 300 wide, with 3 colour values for each pixel. As a tensor, that is 200 by 300 by 3, or 180,000 numbers.

Why it matters

AI tools pass all their data around as tensors. Reading the shape tells you what the data is.

Definition

A tensor is a block of numbers that can stretch in any number of directions. A single number has none, a vector has one, and a matrix has two. A colour photo is a tensor with three: height, width and colour. In AI, data moves from step to step as tensors. The list of its sizes, such as 200 by 300 by 3, is called its shape.
A tensor is the stack on the right. Each page is a matrix, and the stack adds one more direction.

Common mistake

Getting the shape out of order. A tensor of 3 by 200 by 300 holds the same numbers but means something else to the model.

Key takeaways

  1. 1
    Any number of directions. 0, 1, 2, 3 or more.
  2. 2
    Has a shape. Like 200 by 300 by 3.
  3. 3
    How AI moves data. Between every step.