pypto.ge#
产品支持情况#
Ascend 950PR/Ascend 950DT:支持
Atlas A3 训练系列产品/Atlas A3 推理系列产品:支持
Atlas A2 训练系列产品/Atlas A2 推理系列产品:支持
功能说明#
逐元素大于等于比较运算。
函数原型#
ge(input: Tensor, other: Union[Tensor, float, Element]) -> Tensor
参数说明#
参数名 |
输入/输出 |
说明 |
|---|---|---|
input |
输入 |
源操作数。 |
other |
输入 |
源操作数。 |
返回值说明#
返回Shape与输入Tensor一致、数据类型为DT_BOOL的Tensor。若input对应位置的元素值大于或者等于other对应位置的元素值,则该位置的返回值为True,其余位置的返回值为False。
约束说明#
input和other类型须保持一致。
支持一维广播。
Tensor和Element数据类型说明:
Ascend 950PR/Ascend 950DT:DT_FP16, DT_FP32, DT_INT16
Atlas A3 训练系列产品/Atlas A3 推理系列产品:DT_FP16, DT_FP32
Atlas A2 训练系列产品/Atlas A2 推理系列产品:DT_FP16, DT_FP32
Tensor类型输入不支持
TileOpFormat.TILEOP_NZ格式。
调用示例#
TileShape设置示例#
说明:调用该operation接口前,应通过set_vec_tile_shapes设置TileShape。
TileShape维度应和输出一致。
示例1:非广播场景,输入input shape为[m, n],other为[m, n],输出为[m, n],TileShape设置为[m1, n1],则m1, n1分别用于切分m, n轴。
pypto.set_vec_tile_shapes(4, 16)
示例2:广播场景,输入input shape为[m, n],other为[m, 1],输出为[m, n],TileShape设置为[m1, n1],则m1, n1分别用于切分m, n轴。
pypto.set_vec_tile_shapes(4, 16)
接口调用示例#
a = pypto.tensor([3], pypto.DT_FP32)
b = pypto.tensor([3], pypto.DT_FP32)
out = pypto.ge(a, b)
结果示例如下:
输入数据a: [1.0 2.0 3.0]
输入数据b: [2.0 2.0 2.0]
输出数据out: [False, True, True]