Tensors Explained!

Original article was published on Artificial Intelligence on Medium

Scalars and Vectors are special cases of tensors.

Scalars: It’s a physical quantity that can be represented with only magnitude. Since no basis vector is required it is called rank-0-tensor.

  • For example, physical quantities such as temperature, length, and speed only require magnitude to describe them.
  • They can be represented as [95], [7], [447], etc.

Vectors: It’s a single basis vector quantity i.e. alongside magnitude, a basis vector is required to define itself. It’s also called rank-1-vector.

  • For example, displacement requires both magnitude and direction. To determine the direction, x, y and z components are required(also known as unit vectors).
  • They can be represented as a list, [5, 3, 4].

Rank-2-tensor: Consider a situation, in which stress is applied at a point in a rectangular steel beam. There are three ways of cross-section i.e. along x, y, and z-axis. In each cross-section, there are three possibilities to apply force.

  • Here the first subscript denotes the direction perpendicular to the area and the second subscript denotes the direction of force applied.
  • There is a total of 9 components to determine the stress in the beam. It also verifies the formula. total components =. m^n. = 9. (where m, n = 3, 2)
  • They can be represented as a 3 by 3 2-D matrix: [ [1, 2, 3], [4, 5, 6], [7, 8, 9] ]

Key Terminology

  • Shape: The length (number of elements) of each of the dimensions of a tensor.
  • Rank: Number of tensor dimensions. A scalar has rank 0, a vector has rank 1, a matrix is rank 2.
  • Axis or Dimension: A particular dimension of a tensor.
  • Size: The total number of items in the tensor, the product shape vector.