條件

條件 - 16

版本

  • 名稱: 條件 (GitHub)

  • 網域: main

  • since_version: 16

  • 函式: False

  • 支援層級: SupportType.COMMON

  • 形狀推斷: True

此版本的運算子自版本 16 起可用。

摘要

根據條件,從 X 或 Y 返回元素。條件的行為類似於帶有三個參數的 numpy.where

此運算子支援多向(即 Numpy 樣式)廣播;有關更多詳細資訊,請查看ONNX 中的廣播

輸入

  • condition (異質) - B

    當為 True (非零) 時,產生 X,否則產生 Y

  • X (異質) - T

    在條件為 True 的索引處選取的值

  • Y (異質) - T

    在條件為 False 的索引處選取的值

輸出

  • output (異質) - 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)。

條件 - 9

版本

  • 名稱: 條件 (GitHub)

  • 網域: main

  • since_version: 9

  • 函式: False

  • 支援層級: SupportType.COMMON

  • 形狀推斷: True

此版本的運算子自版本 9 起可用。

摘要

根據條件,從 X 或 Y 返回元素。條件的行為類似於帶有三個參數的 numpy.where

此運算子支援多向(即 Numpy 樣式)廣播;有關更多詳細資訊,請查看ONNX 中的廣播

輸入

  • condition (異質) - B

    當為 True (非零) 時,產生 X,否則產生 Y

  • X (異質) - T

    在條件為 True 的索引處選取的值

  • Y (異質) - T

    在條件為 False 的索引處選取的值

輸出

  • output (異質) - 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) ) 中

    將輸入和輸出類型約束為所有張量類型。