PyTorch torch.softmax 関数


Pytorch torch 参考手册Pytorch torch リファレンスマニュアル

torch.softmaxこれは、PyTorch で要素ごとの softmax 関数を計算するための関数です。

関数定義

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

使用例

実例

import torch

# softmax を計算する
x = torch.tensor([1.0, 2.0, 3.0])
result = torch.softmax(x, dim=0)
print(result)

Pytorch torch 参考手册Pytorch torch リファレンスマニュアル

その他の拡張