Tried this example code but got an error:
>>> a = torch.randn(4, 4)
>>> torch.mean(a, 1)

-0.5172
-0.2325
 0.4547
-0.6532
[torch.FloatTensor of size 4x1]

>>> torch.mean(a, 1, True)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: torch.mean received an invalid combination of arguments - got (torch.FloatTensor, int, bool), but expected one of:
 * (torch.FloatTensor source)
 * (torch.FloatTensor source, int dim)

How can I solve this error ?
Also, how can I compute the mean of a matrix ? For instance, I have a b x c x h x w tensor, and I would like to compute the mean of each feature map, so that I got a b x c x 1 x 1 mean tensor. Just like np.mean(a, dim=(2,3)) does.