Hi,
So, when you are doing x.unsqueeze(1), you are basically passing an input size as (8,1,20,20). Now, the output dimensions of your conv operation depends on the number of out_channels you pass in.
so, let’s say you pass in out_channels=1, then you end up with an output size of (8,1,19,19). [19 because you have a kernel of size 2x2 and stride as 1]. In short, the output size (8, x, 19, 19) where x is a variable depending on the number of out_channels you pass.
Finally, for the mean to be a vector of 8 entries, all you need to do is calculate the average across axis=1,2,3.
map0_avg = torch.mean(map0_conv, dim=[1,2,3])

the results would be a vector of size 8.