mindspore.mint.nn.Softmax

View Source On AtomGit
class mindspore.mint.nn.Softmax(dim=None)[source]

Apply the Softmax function to an n-dimensional input tensor.

For details, please refer to mindspore.mint.nn.functional.softmax().

Supported Platforms:

Ascend

Examples

>>> import mindspore
>>> input = mindspore.tensor([-1, -2, 0, 2, 1], mindspore.float16)
>>> softmax = mindspore.mint.nn.Softmax()
>>> output = softmax(input)
>>> print(output)
[0.03168 0.01166 0.0861  0.636   0.2341 ]