Where

Where - 16

版本

  • 名称: Where (GitHub)

  • : main

  • since_version: 16

  • 函数: False

  • 支持级别: SupportType.COMMON

  • 形状推断: True

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

摘要

根据条件从 X 或 Y 返回元素。Where 的行为类似于带三个参数的 numpy.where

此操作符支持多向(即 Numpy 风格)广播;有关更多详细信息,请查看 ONNX 中的广播

输入

  • 条件 (异构) - B

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

  • X (异构) - T

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

  • Y (异构) - T

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

输出

  • 输出 (异构) - T

    形状等于 condition、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

  • 起始版本: 9

  • 函数: False

  • 支持级别: SupportType.COMMON

  • 形状推断: True

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

摘要

根据条件从 X 或 Y 返回元素。Where 的行为类似于带三个参数的 numpy.where

此操作符支持多向(即 Numpy 风格)广播;有关更多详细信息,请查看 ONNX 中的广播

输入

  • 条件 (异构) - B

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

  • X (异构) - T

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

  • Y (异构) - T

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

输出

  • 输出 (异构) - T

    形状等于 condition、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) )

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