Torch.mean() in two dimensions

a tensor with size (a,b,c,d) how to average and reduce it into size (a) using torch.mean()

How about this?

tensor.view(a, -1).mean(1)

Does starting by view first keep the trace of the gradient ?

If you use it on a Variable, then yes.

1 Like