What is a Tensor (Primary Concepts)
1. Imagine a Box of Numbers
- A single number is like a dot → called a 0D tensor (scalar)
- A list of numbers is like a line → called a 1D tensor (vector)
- A grid of numbers (rows and columns) is like a sheet of paper → a 2D tensor (matrix)
- A bunch of sheets stacked (like a book or cube) → 3D tensor
- And it can go even higher (4D, 5D…) for complex data
In a Neural Network:
When data (like images, sentences, or numbers) goes into a neural network, it’s always converted into these tensors — because that’s how the network “sees” the world.
Real-life Examples:
- mage: A colored photo is a 3D tensor
height × width × color channels (like red, green, blue)
- Text: A sentence can be converted to a 2D tensor
number of words × word features (like embedding vectors)
-
Table of numbers (like Excel rows): That’s a 2D tensor
rows = data points, columns = features
Why Tensors Matter in Neural Networks?
- Neural networks do math on these tensors.
- The layers of the network are like machines that twist, stretch, and squeeze these tensors to extract meaning.
Tensor (Primary Concepts) – Tensor example with Simple Python