Tensor Reshape Query
I have a image tensor of shape :-
N,C,H,W = 5,512,13,13

I need to take a mean across H and W dimensions so that the output is of shape :-
N,C,1,1

I am trying doing for loop but is there some better way to do so using reshape. .

 import torch

 tz = torch.rand(5, 512, 13, 13)
 tzm = tz.mean(dim=(2,3), keepdim=True)
 tzm.shape

Output
torch.Size([5, 512, 1, 1])

