PyTorch torch.softmax function


Pytorch torch 参考手册Pytorch torch Reference Manual

torch.softmaxis a function in PyTorch used to compute the element-wise softmax function.

Function Definition

torch.softmax(input, dim, dtype=None)

Usage Example

Example

import torch

# Compute softmax
x = torch.tensor([1.0, 2.0, 3.0])
result = torch.softmax(x, dim=0)
print(result)

Pytorch torch 参考手册Pytorch torch Reference Manual

Other Extensions