Is there an elegant way to get stats (such as min or max) per channel of a tensor?
Let’s say I have this tensor:
a = torch.randn(2, 3, 4)
a
tensor([[[ 0.0064, 0.7634, 0.2181, -2.4037],
[-0.0605, 0.2597, -0.4989, 1.0030],
[ 1.0533, 1.0601, 1.4312, -0.6003]],
[[ 0.1680, -1.4486, -0.3730, -0.6980],
[ 0.3079, 0.7013, 0.9557, -0.4858],
[ 0.1248, -2.0350, 1.2599, -1.4085]]])
What I would like is the following result:
torch.min(a[0,:,:]), torch.min(a[1,:,:])
(tensor(-2.4037), tensor(-2.0350))
but without having to specify each channel explicitly.