PyTorch torch.greater_equal function


Pytorch torch 参考手册Pytorch torch Reference Manual

torch.greater_equalIt is a function in PyTorch for element-wise comparison of greater than or equal. It returns a tensor with True where each element of the first tensor is greater than or equal to the corresponding element of the second tensor.

Function definition

torch.greater_equal(input, other)

Usage example

Example

import torch

# Create two tensors
x = torch.tensor([3, 5, 2])
y = torch.tensor([2, 4, 2])

# Element-wise comparison greater than or equal
result = torch.greater_equal(x, y)
print(result)

The output is:

tensor([True, True, True])

Pytorch torch 参考手册Pytorch torch Reference Manual

Other extensions