Summation of a tensor is giving -inf as output even though no element has -inf value in it

The size of tensor is [4,884736].

I am doing the summation with torch.sum(dim=1)

I have checked whether the tensor has float(‘-inf’) value with :-
1] torch.where(tensor == float(‘-inf’), 1, 0) → count the non_zero → output is zero
2] torch.where(tensor < -7, 1, 0) → count the non_zero → output is zero. Thus specifying the no element is lesser than -7
3] tensor[tensor == float(‘-inf’)] == 0. Still the result is -inf.

Kindly suggest.

Could you post the min() and max() values of this tensor you are trying to reduce?

Here are the max() and min() value of the tensor obtained with torch.max() and torch.min()
MAX_VALUE = -0.0002
MIN_VALUE = -4.9502

Thank you for replying.
This issue can be closed.
It was solved by converting the tensor, before summation, from torch.float16 to torch.float64.