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)