If

If - 23

版本

  • 名稱: If (GitHub)

  • 網域: main

  • since_version: 23

  • function: False

  • support_level: SupportType.COMMON

  • 形狀推論: True

此版本的運算符自 23 版起開始提供。

摘要

If 條件式

屬性

  • else_branch - GRAPH (必要)

    如果條件為 false 時要執行的圖表。有 N 個輸出:您希望即時傳遞到封閉範圍的值。輸出的數量必須與 then_branch 中的輸出數量相符。

  • then_branch - GRAPH (必要)

    如果條件為 true 時要執行的圖表。有 N 個輸出:您希望即時傳遞到封閉範圍的值。輸出的數量必須與 else_branch 中的輸出數量相符。

輸入

  • cond (異質) - B

    if 的條件。張量必須包含單一元素。

輸出

介於 1 和 2147483647 個輸出之間。

  • outputs (可變參數) - V

    即時傳遞到封閉範圍的值。then_branchelse_branch 中的傳回值必須是相同的資料類型。then_branchelse_branch 可能會產生具有相同元素類型但形狀不同的張量。如果來自 then-branch 和 else-branch 的對應輸出具有靜態形狀 S1 和 S2,則 if 節點(如果存在)的對應輸出變數的形狀必須與 S1 和 S2 相容,因為它代表兩種可能形狀的聯集。例如,如果在模型檔案中,then_branch 的第一個輸出是具有形狀 [2] 的浮點張量,而 else_branch 的第一個輸出是另一個具有形狀 [3] 的浮點張量,則 If 的第一個輸出應具有 (a) 未設定形狀,或 (b) 形狀等級為 1,且未設定 dim_valuedim_param,或 (c) 形狀等級為 1,且具有唯一 dim_param。相反地,第一個輸出不能有形狀 [2],因為 [2] 和 [3] 不相容。

類型限制

  • V 的類型為 ( optional(seq(tensor(bfloat16))), optional(seq(tensor(bool))), optional(seq(tensor(complex128))), optional(seq(tensor(complex64))), optional(seq(tensor(double))), optional(seq(tensor(float))), optional(seq(tensor(float16))), optional(seq(tensor(int16))), optional(seq(tensor(int32))), optional(seq(tensor(int64))), optional(seq(tensor(int8))), optional(seq(tensor(string))), optional(seq(tensor(uint16))), optional(seq(tensor(uint32))), optional(seq(tensor(uint64))), optional(seq(tensor(uint8))), optional(tensor(bfloat16)), optional(tensor(bool)), optional(tensor(complex128)), optional(tensor(complex64)), optional(tensor(double)), optional(tensor(float)), optional(tensor(float16)), optional(tensor(float4e2m1)), optional(tensor(float8e4m3fn)), optional(tensor(float8e4m3fnuz)), optional(tensor(float8e5m2)), optional(tensor(float8e5m2fnuz)), optional(tensor(int16)), optional(tensor(int32)), optional(tensor(int4)), optional(tensor(int64)), optional(tensor(int8)), optional(tensor(string)), optional(tensor(uint16)), optional(tensor(uint32)), optional(tensor(uint4)), optional(tensor(uint64)), optional(tensor(uint8)), seq(tensor(bfloat16)), seq(tensor(bool)), seq(tensor(complex128)), seq(tensor(complex64)), seq(tensor(double)), seq(tensor(float)), seq(tensor(float16)), seq(tensor(float4e2m1)), seq(tensor(float8e4m3fn)), seq(tensor(float8e4m3fnuz)), seq(tensor(float8e5m2)), seq(tensor(float8e5m2fnuz)), seq(tensor(int16)), seq(tensor(int32)), seq(tensor(int4)), seq(tensor(int64)), seq(tensor(int8)), seq(tensor(string)), seq(tensor(uint16)), seq(tensor(uint32)), seq(tensor(uint4)), seq(tensor(uint64)), seq(tensor(uint8)), tensor(bfloat16), tensor(bool), tensor(complex128), tensor(complex64), tensor(double), tensor(float), tensor(float16), tensor(float4e2m1), tensor(float8e4m3fn), tensor(float8e4m3fnuz), tensor(float8e5m2), tensor(float8e5m2fnuz), tensor(int16), tensor(int32), tensor(int4), tensor(int64), tensor(int8), tensor(string), tensor(uint16), tensor(uint32), tensor(uint4), tensor(uint64), tensor(uint8) )

    所有 Tensor、Sequence(Tensor)、Optional(Tensor) 和 Optional(Sequence(Tensor)) 類型,直至 IRv11 版本。

  • B 的類型為 ( tensor(bool) )

    僅限 bool 類型。

如果 - 21

版本

  • 名稱: If (GitHub)

  • 網域: main

  • since_version: 21

  • function: False

  • support_level: SupportType.COMMON

  • 形狀推論: True

此版本的運算子自版本 21 開始可用。

摘要

If 條件式

屬性

  • else_branch - GRAPH (必要)

    如果條件為 false 時要執行的圖表。有 N 個輸出:您希望即時傳遞到封閉範圍的值。輸出的數量必須與 then_branch 中的輸出數量相符。

  • then_branch - GRAPH (必要)

    如果條件為 true 時要執行的圖表。有 N 個輸出:您希望即時傳遞到封閉範圍的值。輸出的數量必須與 else_branch 中的輸出數量相符。

輸入

  • cond (異質) - B

    if 的條件。張量必須包含單一元素。

輸出

介於 1 和 2147483647 個輸出之間。

  • outputs (可變參數) - V

    即時傳遞到封閉範圍的值。then_branchelse_branch 中的傳回值必須是相同的資料類型。then_branchelse_branch 可能會產生具有相同元素類型但形狀不同的張量。如果來自 then-branch 和 else-branch 的對應輸出具有靜態形狀 S1 和 S2,則 if 節點(如果存在)的對應輸出變數的形狀必須與 S1 和 S2 相容,因為它代表兩種可能形狀的聯集。例如,如果在模型檔案中,then_branch 的第一個輸出是具有形狀 [2] 的浮點張量,而 else_branch 的第一個輸出是另一個具有形狀 [3] 的浮點張量,則 If 的第一個輸出應具有 (a) 未設定形狀,或 (b) 形狀等級為 1,且未設定 dim_valuedim_param,或 (c) 形狀等級為 1,且具有唯一 dim_param。相反地,第一個輸出不能有形狀 [2],因為 [2] 和 [3] 不相容。

類型約束

  • V 屬於 ( optional(seq(tensor(bfloat16))), optional(seq(tensor(bool))), optional(seq(tensor(complex128))), optional(seq(tensor(complex64))), optional(seq(tensor(double))), optional(seq(tensor(float))), optional(seq(tensor(float16))), optional(seq(tensor(int16))), optional(seq(tensor(int32))), optional(seq(tensor(int64))), optional(seq(tensor(int8))), optional(seq(tensor(string))), optional(seq(tensor(uint16))), optional(seq(tensor(uint32))), optional(seq(tensor(uint64))), optional(seq(tensor(uint8))), optional(tensor(bfloat16)), optional(tensor(bool)), optional(tensor(complex128)), optional(tensor(complex64)), optional(tensor(double)), optional(tensor(float)), optional(tensor(float16)), optional(tensor(float8e4m3fn)), optional(tensor(float8e4m3fnuz)), optional(tensor(float8e5m2)), optional(tensor(float8e5m2fnuz)), optional(tensor(int16)), optional(tensor(int32)), optional(tensor(int4)), optional(tensor(int64)), optional(tensor(int8)), optional(tensor(string)), optional(tensor(uint16)), optional(tensor(uint32)), optional(tensor(uint4)), optional(tensor(uint64)), optional(tensor(uint8)), seq(tensor(bfloat16)), seq(tensor(bool)), seq(tensor(complex128)), seq(tensor(complex64)), seq(tensor(double)), seq(tensor(float)), seq(tensor(float16)), seq(tensor(float8e4m3fn)), seq(tensor(float8e4m3fnuz)), seq(tensor(float8e5m2)), seq(tensor(float8e5m2fnuz)), seq(tensor(int16)), seq(tensor(int32)), seq(tensor(int4)), seq(tensor(int64)), seq(tensor(int8)), seq(tensor(string)), seq(tensor(uint16)), seq(tensor(uint32)), seq(tensor(uint4)), seq(tensor(uint64)), seq(tensor(uint8)), tensor(bfloat16), tensor(bool), tensor(complex128), tensor(complex64), tensor(double), tensor(float), tensor(float16), tensor(float8e4m3fn), tensor(float8e4m3fnuz), tensor(float8e5m2), tensor(float8e5m2fnuz), tensor(int16), tensor(int32), tensor(int4), tensor(int64), tensor(int8), tensor(string), tensor(uint16), tensor(uint32), tensor(uint4), tensor(uint64), tensor(uint8) )

    所有 Tensor、Sequence(Tensor)、Optional(Tensor) 和 Optional(Sequence(Tensor)) 類型,最高至 IRv10。

  • B 的類型為 ( tensor(bool) )

    僅限 bool 類型。

如果 - 19

版本

  • 名稱: If (GitHub)

  • 網域: main

  • since_version: 19

  • function: False

  • support_level: SupportType.COMMON

  • 形狀推論: True

此運算子的版本自版本 19 起提供。

摘要

If 條件式

屬性

  • else_branch - GRAPH (必要)

    如果條件為 false 時要執行的圖表。有 N 個輸出:您希望即時傳遞到封閉範圍的值。輸出的數量必須與 then_branch 中的輸出數量相符。

  • then_branch - GRAPH (必要)

    如果條件為 true 時要執行的圖表。有 N 個輸出:您希望即時傳遞到封閉範圍的值。輸出的數量必須與 else_branch 中的輸出數量相符。

輸入

  • cond (異質) - B

    if 的條件。張量必須包含單一元素。

輸出

介於 1 和 2147483647 個輸出之間。

  • outputs (可變參數) - V

    即時傳遞到封閉範圍的值。then_branchelse_branch 中的傳回值必須是相同的資料類型。then_branchelse_branch 可能會產生具有相同元素類型但形狀不同的張量。如果來自 then-branch 和 else-branch 的對應輸出具有靜態形狀 S1 和 S2,則 if 節點(如果存在)的對應輸出變數的形狀必須與 S1 和 S2 相容,因為它代表兩種可能形狀的聯集。例如,如果在模型檔案中,then_branch 的第一個輸出是具有形狀 [2] 的浮點張量,而 else_branch 的第一個輸出是另一個具有形狀 [3] 的浮點張量,則 If 的第一個輸出應具有 (a) 未設定形狀,或 (b) 形狀等級為 1,且未設定 dim_valuedim_param,或 (c) 形狀等級為 1,且具有唯一 dim_param。相反地,第一個輸出不能有形狀 [2],因為 [2] 和 [3] 不相容。

類型約束

  • V 屬於 ( optional(seq(tensor(bfloat16))), optional(seq(tensor(bool))), optional(seq(tensor(complex128))), optional(seq(tensor(complex64))), optional(seq(tensor(double))), optional(seq(tensor(float))), optional(seq(tensor(float16))), optional(seq(tensor(int16))), optional(seq(tensor(int32))), optional(seq(tensor(int64))), optional(seq(tensor(int8))), optional(seq(tensor(string))), optional(seq(tensor(uint16))), optional(seq(tensor(uint32))), optional(seq(tensor(uint64))), optional(seq(tensor(uint8))), optional(tensor(bfloat16)), optional(tensor(bool)), optional(tensor(complex128)), optional(tensor(complex64)), optional(tensor(double)), optional(tensor(float)), optional(tensor(float16)), optional(tensor(float8e4m3fn)), optional(tensor(float8e4m3fnuz)), optional(tensor(float8e5m2)), optional(tensor(float8e5m2fnuz)), optional(tensor(int16)), optional(tensor(int32)), optional(tensor(int64)), optional(tensor(int8)), optional(tensor(string)), optional(tensor(uint16)), optional(tensor(uint32)), optional(tensor(uint64)), optional(tensor(uint8)), seq(tensor(bfloat16)), seq(tensor(bool)), seq(tensor(complex128)), seq(tensor(complex64)), seq(tensor(double)), seq(tensor(float)), seq(tensor(float16)), seq(tensor(float8e4m3fn)), seq(tensor(float8e4m3fnuz)), seq(tensor(float8e5m2)), seq(tensor(float8e5m2fnuz)), seq(tensor(int16)), seq(tensor(int32)), seq(tensor(int64)), seq(tensor(int8)), seq(tensor(string)), seq(tensor(uint16)), seq(tensor(uint32)), seq(tensor(uint64)), seq(tensor(uint8)), tensor(bfloat16), tensor(bool), tensor(complex128), tensor(complex64), tensor(double), tensor(float), tensor(float16), tensor(float8e4m3fn), tensor(float8e4m3fnuz), tensor(float8e5m2), tensor(float8e5m2fnuz), tensor(int16), tensor(int32), tensor(int64), tensor(int8), tensor(string), tensor(uint16), tensor(uint32), tensor(uint64), tensor(uint8) )

    所有 Tensor、Sequence(Tensor)、Optional(Tensor) 和 Optional(Sequence(Tensor)) 類型,最高至 IRv9。

  • B 的類型為 ( tensor(bool) )

    僅限 bool 類型。

如果 - 16

版本

  • 名稱: If (GitHub)

  • 網域: main

  • since_version: 16

  • function: False

  • support_level: SupportType.COMMON

  • 形狀推論: True

此運算子的版本自版本 16 起提供。

摘要

If 條件式

屬性

  • else_branch - GRAPH (必要)

    如果條件為 false 時要執行的圖表。有 N 個輸出:您希望即時傳遞到封閉範圍的值。輸出的數量必須與 then_branch 中的輸出數量相符。

  • then_branch - GRAPH (必要)

    如果條件為 true 時要執行的圖表。有 N 個輸出:您希望即時傳遞到封閉範圍的值。輸出的數量必須與 else_branch 中的輸出數量相符。

輸入

  • cond (異質) - B

    if 的條件。張量必須包含單一元素。

輸出

介於 1 和 2147483647 個輸出之間。

  • outputs (可變參數) - V

    即時傳遞到封閉範圍的值。then_branchelse_branch 中的傳回值必須是相同的資料類型。then_branchelse_branch 可能會產生具有相同元素類型但形狀不同的張量。如果來自 then-branch 和 else-branch 的對應輸出具有靜態形狀 S1 和 S2,則 if 節點(如果存在)的對應輸出變數的形狀必須與 S1 和 S2 相容,因為它代表兩種可能形狀的聯集。例如,如果在模型檔案中,then_branch 的第一個輸出是具有形狀 [2] 的浮點張量,而 else_branch 的第一個輸出是另一個具有形狀 [3] 的浮點張量,則 If 的第一個輸出應具有 (a) 未設定形狀,或 (b) 形狀等級為 1,且未設定 dim_valuedim_param,或 (c) 形狀等級為 1,且具有唯一 dim_param。相反地,第一個輸出不能有形狀 [2],因為 [2] 和 [3] 不相容。

類型約束

  • V in ( optional(seq(tensor(bfloat16))), optional(seq(tensor(bool))), optional(seq(tensor(complex128))), optional(seq(tensor(complex64))), optional(seq(tensor(double))), optional(seq(tensor(float))), optional(seq(tensor(float16))), optional(seq(tensor(int16))), optional(seq(tensor(int32))), optional(seq(tensor(int64))), optional(seq(tensor(int8))), optional(seq(tensor(string))), optional(seq(tensor(uint16))), optional(seq(tensor(uint32))), optional(seq(tensor(uint64))), optional(seq(tensor(uint8))), optional(tensor(bfloat16)), optional(tensor(bool)), optional(tensor(complex128)), optional(tensor(complex64)), optional(tensor(double)), optional(tensor(float)), optional(tensor(float16)), optional(tensor(int16)), optional(tensor(int32)), optional(tensor(int64)), optional(tensor(int8)), optional(tensor(string)), optional(tensor(uint16)), optional(tensor(uint32)), optional(tensor(uint64)), optional(tensor(uint8)), seq(tensor(bfloat16)), seq(tensor(bool)), seq(tensor(complex128)), seq(tensor(complex64)), seq(tensor(double)), seq(tensor(float)), seq(tensor(float16)), seq(tensor(int16)), seq(tensor(int32)), seq(tensor(int64)), seq(tensor(int8)), seq(tensor(string)), seq(tensor(uint16)), seq(tensor(uint32)), seq(tensor(uint64)), seq(tensor(uint8)), 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) )

    所有 Tensor、Sequence(Tensor)、Optional(Tensor) 和 Optional(Sequence(Tensor)) 類型,最高支援到 IRv4。

  • B 的類型為 ( tensor(bool) )

    僅限 bool 類型。

If - 13

版本

  • 名稱: If (GitHub)

  • 網域: main

  • since_version: 13

  • function: False

  • support_level: SupportType.COMMON

  • 形狀推論: True

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

摘要

If 條件式

屬性

  • else_branch - GRAPH (必要)

    如果條件為 false 時要執行的圖表。有 N 個輸出:您希望即時傳遞到封閉範圍的值。輸出的數量必須與 then_branch 中的輸出數量相符。

  • then_branch - GRAPH (必要)

    如果條件為 true 時要執行的圖表。有 N 個輸出:您希望即時傳遞到封閉範圍的值。輸出的數量必須與 else_branch 中的輸出數量相符。

輸入

  • cond (異質) - B

    if 的條件。張量必須包含單一元素。

輸出

介於 1 和 2147483647 個輸出之間。

  • outputs (可變參數) - V

    即時傳遞到封閉範圍的值。then_branchelse_branch 中的傳回值必須是相同的資料類型。then_branchelse_branch 可能會產生具有相同元素類型但形狀不同的張量。如果來自 then-branch 和 else-branch 的對應輸出具有靜態形狀 S1 和 S2,則 if 節點(如果存在)的對應輸出變數的形狀必須與 S1 和 S2 相容,因為它代表兩種可能形狀的聯集。例如,如果在模型檔案中,then_branch 的第一個輸出是具有形狀 [2] 的浮點張量,而 else_branch 的第一個輸出是另一個具有形狀 [3] 的浮點張量,則 If 的第一個輸出應具有 (a) 未設定形狀,或 (b) 形狀等級為 1,且未設定 dim_valuedim_param,或 (c) 形狀等級為 1,且具有唯一 dim_param。相反地,第一個輸出不能有形狀 [2],因為 [2] 和 [3] 不相容。

類型約束

  • V in ( seq(tensor(bool)), seq(tensor(complex128)), seq(tensor(complex64)), seq(tensor(double)), seq(tensor(float)), seq(tensor(float16)), seq(tensor(int16)), seq(tensor(int32)), seq(tensor(int64)), seq(tensor(int8)), seq(tensor(string)), seq(tensor(uint16)), seq(tensor(uint32)), seq(tensor(uint64)), seq(tensor(uint8)), 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) )

    所有 Tensor 和 Sequence 類型

  • B 的類型為 ( tensor(bool) )

    僅限 bool 類型。

If - 11

版本

  • 名稱: If (GitHub)

  • 網域: main

  • since_version: 11

  • function: False

  • support_level: SupportType.COMMON

  • 形狀推論: True

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

摘要

If 條件式

屬性

  • else_branch - GRAPH (必要)

    如果條件為 false 時要執行的圖表。有 N 個輸出:您希望即時傳遞到封閉範圍的值。輸出的數量必須與 then_branch 中的輸出數量相符。

  • then_branch - GRAPH (必要)

    如果條件為 true 時要執行的圖表。有 N 個輸出:您希望即時傳遞到封閉範圍的值。輸出的數量必須與 else_branch 中的輸出數量相符。

輸入

  • cond (異質) - B

    if 的條件。張量必須包含單一元素。

輸出

介於 1 和 2147483647 個輸出之間。

  • outputs (可變參數) - V

    即時傳遞到封閉範圍的值。then_branchelse_branch 中的傳回值必須是相同的資料類型。then_branchelse_branch 可能會產生具有相同元素類型但形狀不同的張量。如果來自 then-branch 和 else-branch 的對應輸出具有靜態形狀 S1 和 S2,則 if 節點(如果存在)的對應輸出變數的形狀必須與 S1 和 S2 相容,因為它代表兩種可能形狀的聯集。例如,如果在模型檔案中,then_branch 的第一個輸出是具有形狀 [2] 的浮點張量,而 else_branch 的第一個輸出是另一個具有形狀 [3] 的浮點張量,則 If 的第一個輸出應具有 (a) 未設定形狀,或 (b) 形狀等級為 1,且未設定 dim_valuedim_param,或 (c) 形狀等級為 1,且具有唯一 dim_param。相反地,第一個輸出不能有形狀 [2],因為 [2] 和 [3] 不相容。

類型約束

  • V in ( 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) )

    所有 Tensor 類型

  • B 的類型為 ( tensor(bool) )

    僅限 bool 類型。

If - 1

版本

  • 名稱: If (GitHub)

  • 網域: main

  • since_version: 1

  • function: False

  • support_level: SupportType.COMMON

  • 形狀推論: True

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

摘要

If 條件式

屬性

  • else_branch - GRAPH (必要)

    如果條件為 false 時要執行的圖表。有 N 個輸出:您希望即時傳遞到封閉範圍的值。輸出的數量必須與 then_branch 中的輸出數量相符。

  • then_branch - GRAPH (必要)

    如果條件為 true 時要執行的圖表。有 N 個輸出:您希望即時傳遞到封閉範圍的值。輸出的數量必須與 else_branch 中的輸出數量相符。

輸入

  • cond (異質) - B

    if 的條件。張量必須包含單一元素。

輸出

介於 1 和 2147483647 個輸出之間。

  • outputs (可變參數) - V

    會輸出到封閉範圍的值。 then_branchelse_branch 中的傳回值必須具有相同的形狀和相同的資料類型。

類型約束

  • V in ( 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) )

    所有 Tensor 類型

  • B 的類型為 ( tensor(bool) )

    僅限 bool 類型。