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: img_gray_naive = img_t.mean(-3) batch_gray_naive = batch_t.mean(-3) img_gray_naive.shape, batch_gray_naive.shape # Out: (torch.Size([5, 5]), torch.Size([2, 5, 5]))
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?