PyTorch torch.greater_equal 関数


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

torch.greater_equalこれは、PyTorchで要素ごとに「以上」を比較するための関数です。最初のテンソルの要素が2番目のテンソルの対応する要素以上である位置がTrueとなるテンソルを返します。

関数定義

torch.greater_equal(input, other)

使用例

例

import torch

# 2つのテンソルを作成
x = torch.tensor([3, 5, 2])
y = torch.tensor([2, 4, 2])

# 要素ごとに >= を比較
result = torch.greater_equal(x, y)
print(result)

出力結果は次のとおりです:

tensor([True, True, True])

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

その他の拡張