What is Tensor?
In Turkish: Tensör · Topic: Math foundations
A data structure that arranges numbers as a single value, a vector, a matrix, or an array with even more axes. In AI, nearly everything, from text and images to model weights, is stored as tensors.
How does it work?
A tensor's number of axes is called its rank or number of dimensions. A single number has zero axes, a row of numbers (a vector) has one, and a table of rows and columns (a matrix) has two. A color photo is a three-axis tensor of height, width and color channel, and a batch of photos adds a fourth axis. Libraries such as PyTorch and TensorFlow are built to process tensors in bulk on GPUs.
Why does it matter?
Neural networks do all their computation on tensors, so training and inference speed depends on how efficiently hardware handles them. Nvidia's GPUs and Google's TPU chips are designed around this kind of work. Terms in the news such as 'tensor cores' come from the same idea.
Example
A 256 × 256 pixel color photo is fed to a model as a three-axis tensor of shape 256 × 256 × 3.
FAQ
Is a tensor the same as a matrix?
A matrix is the special case of a tensor with two axes. The tensor concept places no limit on the number of axes; it can have three, four or more.
Is a tensor in AI the same as a tensor in physics?
In mathematics and physics, tensors are defined by how they transform under changes of coordinates. In AI software the word usually just means a multi-dimensional array of numbers, and that meaning is enough for practical purposes.