Why tensors?

The tensor structure helps us by giving us the freedom to shape the dataset the way we want.

This is particularly helpful when dealing with images, due to the nature of how information in images are encoded.

Thinking about images, it's easy to understand that it has a height and width, so it would make sense to represent the information contained in it with a two-dimensional structure (a matrix)... until you remember that images have colors. To add information about the colors, we need another dimension, and that's when Tensors become particularly helpful.

Images are encoded into color channels; image data is represented in each color's intensity in a color channel at a given point, the most common one being RGB (which means red, blue, and green). The information contained in an image is the intensity of each channel color in the width and height of the image, just like this:

Figure 10: Different color channels for a specific image

So, the intensity of the red channel at each point with width and height can be represented in a matrix; the same goes for the blue and green channels. So, we end up having three matrices, and when these are combined, they form a tensor.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset