Torch.mean() misunderstand

I can not understand how to evaluate this expression:
x.view(*(x.shape[:-2]),-1).mean(-1), x in shape(N, C, H, W)
what is the astrick ? and what is mean(-1) ?
Thanks in advance

with asterisk you are passing list as args

def test(*args):
mylist = [5,3,32,32]

#the result is (5, 3, 32, 32)
1 Like

what about mean(-1) ??

-1 as a dimension argument means the last dimension. -2 the last but one, etc.

1 Like