位置

Where - 16

版本

  • 名称: Where (GitHub)

  • 域名: main

  • since_version: 16

  • 函数: False

  • support_level: SupportType.COMMON

  • 形状推断: True

此版本的运算符自版本16起可用。

摘要

根据条件返回元素,这些元素可能来自X或Y。 Where的行为类似于 numpy.where ,它有三个参数。

该操作符支持多向(即Numpy风格)广播;更多详情请查看Broadcasting in ONNX

输入

  • 条件 (异构) - B:

    当为True(非零)时,生成X,否则生成Y

  • X (异构) - T:

    在条件为True的索引处选择的值

  • Y (异构) - T:

    在条件为False的索引处选择的值

输出

  • 输出 (异构) - T:

    形状等于条件、X和Y的广播形状的张量。

类型约束

  • B 在 ( tensor(bool) ) 中:

    限制为布尔张量。

  • T 在 ( tensor(bfloat16), tensor(bool), tensor(complex128), tensor(complex64), tensor(double), tensor(float), tensor(float16), tensor(int16), tensor(int32), tensor(int64), tensor(int8), tensor(string), tensor(uint16), tensor(uint32), tensor(uint64), tensor(uint8) ):

    将输入和输出类型限制为所有张量类型(包括bfloat)。

Where - 9

版本

  • 名称: Where (GitHub)

  • 域名: main

  • since_version: 9

  • 函数: False

  • support_level: SupportType.COMMON

  • 形状推断: True

此版本的运算符自版本9起可用。

摘要

根据条件返回元素,这些元素可能来自X或Y。 Where的行为类似于 numpy.where ,它有三个参数。

该操作符支持多向(即Numpy风格)广播;更多详情请查看Broadcasting in ONNX

输入

  • 条件 (异构) - B:

    当为True(非零)时,生成X,否则生成Y

  • X (异构) - T:

    在条件为True的索引处选择的值

  • Y (异构) - T:

    在条件为False的索引处选择的值

输出

  • 输出 (异构) - T:

    形状等于条件、X和Y的广播形状的张量。

类型约束

  • B 在 ( tensor(bool) ) 中:

    限制为布尔张量。

  • T 在 ( tensor(bool), tensor(complex128), tensor(complex64), tensor(double), tensor(float), tensor(float16), tensor(int16), tensor(int32), tensor(int64), tensor(int8), tensor(string), tensor(uint16), tensor(uint32), tensor(uint64), tensor(uint8) ):

    将输入和输出类型限制为所有张量类型。