PyTorch torch.positive 関数
torch.positivePyTorch において要素ごとに正の値を取るための関数です。入力テンソルそのものを返します。
関数定義
torch.positive(input)
使用例
実例
import torch
# 要素ごとに正の値を取る
x = torch.tensor([1.0, 2.0, 3.0])
result = torch.positive(x)
print(result)
# 要素ごとに正の値を取る
x = torch.tensor([1.0, 2.0, 3.0])
result = torch.positive(x)
print(result)
その他の拡張
Pytorch torch リファレンスマニュアル