Issue description
Just to check. When passing a tensor of -inf to nn.Softmax, it returns a tensor of nan. I know it's a very rare case but do we expect this result? Should we add a warning there?
Relevant issue #24816
Code example
Please try to provide a minimal example to repro the bug.
import torch
x = torch.Tensor([[[float("-inf"), float("-inf"), float("-inf")]]])
softmax = torch.nn.Softmax(dim=-1)
softmax(x)
>>> tensor([[[ nan, nan, nan]]])
Issue description
Just to check. When passing a tensor of
-inftonn.Softmax, it returns a tensor ofnan. I know it's a very rare case but do we expect this result? Should we add a warning there?Relevant issue #24816
Code example
Please try to provide a minimal example to repro the bug.