Softmin#
- class torch.nn.modules.activation.Softmin(dim=None)[源代码]#
对 n 维输入 Tensor 应用 Softmin 函数。
重新缩放输入 so that the elements of the n-dimensional output Tensor lie in the range [0, 1] and sum to 1.
Softmin 定义为
- 形状
输入: ,其中 * 表示任意数量的附加维度
输出: ,与输入形状相同
- 参数
dim (int) – A dimension along which Softmin will be computed (so every slice along dim will sum to 1).
- 返回
a Tensor of the same dimension and shape as the input, with values in the range [0, 1]
- 返回类型
无
示例
>>> m = nn.Softmin(dim=1) >>> input = torch.randn(2, 3) >>> output = m(input)