In section 7.1.4, the authors write:
In[16]:
mean = imgs.view(3, -1).mean(dim=1)
mean
Out[16]:
tensor([0.4914, 0.4822, 0.4465])
Recall that view(3, -1) keeps the three channels and merges all the remaining dimen-
sions into one, figuring out the appropriate size. Here, our 3 × 32 × 32 image is trans-
formed into a 3 × 1,024 vector, and then the mean is taken over the 1,024 elements of
each channel.
However, this is the first time that the view() method has been used in the book. "Recall" is not applicable.
In section 7.1.4, the authors write:
mean = imgs.view(3, -1).mean(dim=1)
mean
Out[16]:
tensor([0.4914, 0.4822, 0.4465])
Recall that view(3, -1) keeps the three channels and merges all the remaining dimen-
sions into one, figuring out the appropriate size. Here, our 3 × 32 × 32 image is trans-
formed into a 3 × 1,024 vector, and then the mean is taken over the 1,024 elements of
each channel.
However, this is the first time that the view() method has been used in the book. "Recall" is not applicable.