AIExplainer
Machine Learning Intermediate 1 min read

What is a Tensor shape?

The dimensions of a multi-dimensional array in machine learning

In machine learning, a tensor is a way of representing complex data. The tensor shape refers to the number of dimensions and the size of each dimension in the tensor, which determines how the data is organized and processed.

Think of a tensor shape like the dimensions of a box. Just as a box has a length, width, and height, a tensor has multiple dimensions that define its size and structure.

For example, an image can be represented as a tensor with a shape of (height, width, channels), where height and width are the dimensions of the image and channels represent the color information.

Tensor shapes are used to define the structure of data in machine learning models, such as neural networks, and to perform operations on that data.

A common misconception is that tensor shape is the same as the size of the tensor, but it's actually the dimensions of the tensor that define its shape.

The concept of tensor shapes originated in the field of linear algebra and has been adopted in machine learning to efficiently represent and process complex data.

tensor dimensions array shape data structure

Three products for different needs — explore what’s relevant to you.