LOGSOFTMAX
CLASS torch.nn.LogSoftmax(dim: Optional[int] = None)
将函数应用于n维输入张量。 LogSoftmax公式可以简化为:
Shape:
-
Input: (∗) where ∗ means, any number of additional dimensions
-
Output: (∗) , same shape as the input
Parameters
dim (int) – A dimension along which LogSoftmax will be computed.用来计算LogSoftmax的维度。
Returns
a Tensor of the same dimension and shape as the input with values in the range [-inf, 0)。与输入具有相同维度和形状的张量,其值在[-inf,0)范围内。
Examples:
>>> m = nn.LogSoftmax() >>> input = torch.randn(2, 3) >>> output = m(input)