我要评分
获取效率
正确性
完整性
易理解

Greater

Function

Compare two input tensors and return a Boolean tensor element by element, indicating whether the first input tensor is greater than the second one.

Prototype

1
2
3
4
5
int Greater(T *input0, T *input1, bool *output, size_t length);       // input0 and input1 are pointer variables.

int Greater(T *input0, T input1, bool *output, size_t length);        // input0 is a pointer variable.

int Greater(T input0, T *input1, bool *output, size_t length);        // input1 is a pointer variable.
  • This API accepts only 1D tensors as inputs.
  • Template type T: int64_t and int32_t are supported.
  • The valid spaces of pointers are specified by the user.
  • Ensure that the valid spaces of the input pointers do not overlap.

Parameters

Parameter

Input/Output

Description

Constraint

input0

Input

Tensor to be compared.

This pointer is not null and only 1D tensors are accepted. Scalars are accepted, but input0 and input1 cannot both be scalars.

input1

Input

Tensor used for comparison.

This pointer is not null and only 1D tensors are accepted. Scalars are accepted, but input1 and input0 cannot both be scalars.

output

Input

Tensor used to store the comparison results as the output.

This pointer is not null and only 1D tensors are accepted.

length

Input

Length of the tensor used for calculation.

The value range is [0, 2^64 – 1]. The length value is equal to the minimum value among the valid spaces of output, input0, and input1. The value must be checked by the user to prevent security issues such as buffer overflow.