Hello, I want to know what is the most simple way to get the mean of the matrix along each column, namely my tensor only has two dimensions with shape (m X n).
For example, if I have a tensor object
T = torch.FloatTensor([[2.6, 5], [1.7, 6], [3.2, 7], [2.1, 8]])
I want some function that could return a tensor object as following
([2.4, 6.5])
I know I could do with for loop, but I wonder if there is a PyTorch built-in method that could do this for me, or is there some more elegant way for this purpose.
mean = torch.zeros(T.size(1))
for i in range(T.size(1)):
mean[i] = torch.mean(T[:, i])
Thanks for any help.