Where

Where - 16

版本

  • 名称: Where (GitHub)

  • : main

  • 起始版本: 16

  • 函数: False

  • 支持级别: SupportType.COMMON

  • 形状推断: True

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

摘要

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

此运算符支持多向(即 Numpy 风格)广播;有关更多详细信息,请查看 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

  • 起始版本: 9

  • 函数: False

  • 支持级别: SupportType.COMMON

  • 形状推断: True

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

摘要

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

此运算符支持多向(即 Numpy 风格)广播;有关更多详细信息,请查看 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) )

    约束输入和输出类型为所有张量类型。