# What does it mean by "lazy mean" here?

Consider the following paragraph, taken from 3.4: Named Tensors of the textbook named Deep Learning with PyTorch by Eli Stevens et al., regarding the calculation of the mean for RGB channels of an RGB image in order to convert it into a grayscale image

So sometimes the RGB channels are in dimension 0, and sometimes they are in dimension 1. But we can generalize by counting from the end: they are always in dimension –3, the third from the end. The lazy, unweighted mean can thus be written as follows:

# In[4]:
img_gray_naive = img_t.mean(-3)
batch_gray_naive = batch_t.mean(-3)
img_gray_naive.shape, batch_gray_naive.shape

# Out[4]:
(torch.Size([5, 5]), torch.Size([2, 5, 5]))


Here img_t is a single image tensor of shape (3, 5, 5) and batch_t is a batch of 2 images with the same shape. They are taking the mean over the channel dimension.

Since they are taking the normal average of the intensity values over RGB channels, it is unweighted. But, what does it mean by lazy here? Are they referring to some implementation detail regarding lazy initialization? If yes, what exactly does it mean?

## 1 Answer

Looking at the variable names in the code and considering the context, it seems to me that the author is using the word "Lazy" to describe the approach. I believe the author actually means that a naïve approach to producing a grayscale image is being used.

If you want to use a less-naïve approach, you might consider producing the dot product of the 3 channel color depth by a vector such as [0.2126, 0.7153, 0.0722] which will produce something a bit more accurate.