Rate This Document
Findability
Accuracy
Completeness
Readability

SoftMax

Function

Compute the normalized exponential probability distribution along the specified dimension.

Prototype

torch.nn.Softmax(
    dim: Optional[int] = None
)
# Or function-style
torch.nn.functional.softmax(
    input: Tensor, 
    dim: int, 
    dtype: Optional[torch.dtype] = None
) -> Tensor

Parameters

Table 1 Parameter description

Parameter

Type

Mandatory (Yes/No)

Description

dim

int

Yes

Dimension to compute. For example, dim=1 indicates that the computation is performed on each row.

input

Tensor

Yes

Input tensor (dedicated for function-style).

dtype

torch.dtype

No

Output data type (dedicated for function-style).