convert nn.Softmax to torch.tensor
I have a softmax function at the end of my Neural Network.
I want to have the probabilities as torch.tensor.For it I am using  torch.tensor(nn.softmax(x)) and getting error RuntimeError: Could not infer dtype of Softmax.
May I please know what I am doing wrong here or is there any other way to do it.

nn.Softmax is a class. You can use it like this:
import torch

x = torch.tensor([10., 3., 8.])
softmax = torch.nn.Softmax(dim=0)

probs = softmax(x)

or, you can use the Functional API torch.nn.functional.softmax:
import torch

x = torch.tensor([10., 3., 8.])

probs = torch.nn.functional.softmax(x, dim=0)

They are equivalent. In both cases, you can check that type(probs) is &lt;class 'torch.Tensor'&gt;.
