mindspore.mint.nn.Softmax

查看源文件
class mindspore.mint.nn.Softmax(dim=None)[源代码]

对n维输入tensor应用Softmax函数。

更多参考详见 mindspore.mint.nn.functional.softmax()

支持平台:

Ascend

样例:

>>> 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 ]