PyTorch torch.xlogy 関数


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

torch.xlogyPyTorch で要素ごとに input * log(other) を計算する関数です。other が 0 の場合、0 を返します。

関数定義

torch.xlogy(input, other, out=None)

使用例

例

import torch

# x * log(y) を計算
x = torch.tensor([1.0, 2.0, 3.0])
y = torch.tensor([2.0, 3.0, 4.0])
result = torch.xlogy(x, y)
print(result)

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

その他の拡張