Fastbook 04 MNIST basics, value of tensor is inverse to image

Hey all,

I started reading chapter 4 of fastbook 04_mnist_basics. During data exploration when we display the image it is shown a black background and white font color, like this:
image

However, when we convert it to tensor and display the top left corner is 0, which is then explained as 0 for white and 255 for black.

You can see that the background white pixels are stored as the number 0, black is the number 255, and shades of gray are between the two.

However, as per the explanation, the tensor matrix should be the inverse right? Something like this:
image

Now when I looked at the background_gradient documentation it simply shows the heatmap based on value, so we are for sure not inverting the values there.
Am I missing something or is 0 for black and 255 for white? But if that is the case

Image data is 0 - black and 255 white. When that is graphed in a heat map it will display (intensity) according to the palette used.

For e.g a grey/grey palette for non-Color print medium uses more ink to show higher values, thus 255 is graphed in black.

You can select another palette name instead of ‘greys’ Choosing Colormaps in Matplotlib — Matplotlib 3.7.1 documentation