Hi
I have a tensor and i need to count number of 1’s in each column
B=torch.Tensor([[[0., 0., 0., 0., 1.]],
[[0., 0., 0., 0., 1.]],
[[0., 1., 0., 0., 1.]]])
and i need an output like this:
output=tensor([[0.],
[1.],
[0.],
[0.],
[3.]])
I will be grateful if someone gives me a help