Tensor

A tensor is an array of numbers, which can be thought of as being organized in a grid or lattice pattern. The term "rank" is used to describe the dimensionality of a tensor. Rank-0, rank-1, and rank-2 tensors are more commonly known, respectively, as a scalar, a vector, and a matrix. The rank is therefore the number of indices required to access each element in a tensor. A rank-N tensor can also be viewed as a list of rank-{N-1} tensors. Example: an RGB image is a rank-3 tensor, where each channel (Red, Green, or Blue) is a rank-2 tensor; thus a batch of RGB images of equal width, height, and number of channels, can be stored in a rank-4 tensor.