
Dimensionality of data
So, consider the tensor of a shape (400, 600, 3). This is a common input shape that refers to a three-dimensional tensor that's used to represent a color image of 400 x 600 pixels. Since the MNIST dataset uses binary grayscale pixel values, we only deal with matrices of 28 x 28 pixels when representing an image. Here, each image is a tensor of dimension two, and the whole dataset can be represented by a tensor of dimension three. In a color image, each pixel value actually has three numbers, representing the amount of red, green, and blue light intensity represented by that pixel. Hence, with colored images, the two-dimensional matrices that are used to represent an image now scale up to three-dimensional tensors. Such a tensor is denoted by a tuple of (x, y, 3), where x and y represent the pixel dimensions of the image. Hence, a dataset of color images can be represented by a four-dimensional tensor, as we will see in later examples. For now, it is useful to know that we can use NumPy n-dimensional arrays to represent, reshape, manipulate, and store tensors in Python.