If

If - 23

版本

  • 名称: If (GitHub)

  • : main

  • 起始版本: 23

  • 函数: False

  • 支持级别: SupportType.COMMON

  • 形状推断: True

此版本算子自 版本 23 起可用。

摘要

条件 If

属性

  • else_branch - 图 (GRAPH) (必需)

    条件为假时运行的图。有 N 个输出:希望活出到封闭范围的值。输出数量必须与 then_branch 中的输出数量匹配。

  • then_branch - 图 (GRAPH) (必需)

    条件为真时运行的图。有 N 个输出:希望活出到封闭范围的值。输出数量必须与 else_branch 中的输出数量匹配。

输入

  • cond (异构) - B

    If 的条件。张量必须包含一个元素。

输出

输出数量介于 1 和 2147483647 之间。

  • outputs (可变参数) - V

    活出到封闭范围的值。 then_branchelse_branch 中的返回值必须是相同的数据类型。 then_branchelse_branch 可以生成具有相同元素类型但形状不同的张量。如果 then-branch 和 else-branch 的对应输出具有静态形状 S1 和 S2,则 if-node 的对应输出变量(如果存在)的形状必须与 S1 和 S2 都兼容,因为它表示两种可能形状的并集。例如,如果在模型文件中,then_branch 的第一个输出是形状为 [2] 的浮点张量,而 else_branch 的第一个输出是形状为 [3] 的另一个浮点张量,则 If 的第一个输出应具有 (a) 未设置形状,或 (b) 秩为 1 且未设置 dim_value 也未设置 dim_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) )

    最高支持 IRv11 的所有 Tensor、Sequence(Tensor)、Optional(Tensor) 和 Optional(Sequence(Tensor)) 类型。

  • B 属于 ( tensor(bool) )

    仅 bool 类型

If - 21

版本

  • 名称: If (GitHub)

  • : main

  • 起始版本: 21

  • 函数: False

  • 支持级别: SupportType.COMMON

  • 形状推断: True

此版本算子自 版本 21 起可用。

摘要

条件 If

属性

  • else_branch - 图 (GRAPH) (必需)

    条件为假时运行的图。有 N 个输出:希望活出到封闭范围的值。输出数量必须与 then_branch 中的输出数量匹配。

  • then_branch - 图 (GRAPH) (必需)

    条件为真时运行的图。有 N 个输出:希望活出到封闭范围的值。输出数量必须与 else_branch 中的输出数量匹配。

输入

  • cond (异构) - B

    If 的条件。张量必须包含一个元素。

输出

输出数量介于 1 和 2147483647 之间。

  • outputs (可变参数) - V

    活出到封闭范围的值。 then_branchelse_branch 中的返回值必须是相同的数据类型。 then_branchelse_branch 可以生成具有相同元素类型但形状不同的张量。如果 then-branch 和 else-branch 的对应输出具有静态形状 S1 和 S2,则 if-node 的对应输出变量(如果存在)的形状必须与 S1 和 S2 都兼容,因为它表示两种可能形状的并集。例如,如果在模型文件中,then_branch 的第一个输出是形状为 [2] 的浮点张量,而 else_branch 的第一个输出是形状为 [3] 的另一个浮点张量,则 If 的第一个输出应具有 (a) 未设置形状,或 (b) 秩为 1 且未设置 dim_value 也未设置 dim_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 类型

If - 19

版本

  • 名称: If (GitHub)

  • : main

  • 起始版本: 19

  • 函数: False

  • 支持级别: SupportType.COMMON

  • 形状推断: True

此版本的操作符从版本 19 开始可用。

摘要

条件 If

属性

  • else_branch - 图 (GRAPH) (必需)

    条件为假时运行的图。有 N 个输出:希望活出到封闭范围的值。输出数量必须与 then_branch 中的输出数量匹配。

  • then_branch - 图 (GRAPH) (必需)

    条件为真时运行的图。有 N 个输出:希望活出到封闭范围的值。输出数量必须与 else_branch 中的输出数量匹配。

输入

  • cond (异构) - B

    If 的条件。张量必须包含一个元素。

输出

输出数量介于 1 和 2147483647 之间。

  • outputs (可变参数) - V

    活出到封闭范围的值。 then_branchelse_branch 中的返回值必须是相同的数据类型。 then_branchelse_branch 可以生成具有相同元素类型但形状不同的张量。如果 then-branch 和 else-branch 的对应输出具有静态形状 S1 和 S2,则 if-node 的对应输出变量(如果存在)的形状必须与 S1 和 S2 都兼容,因为它表示两种可能形状的并集。例如,如果在模型文件中,then_branch 的第一个输出是形状为 [2] 的浮点张量,而 else_branch 的第一个输出是形状为 [3] 的另一个浮点张量,则 If 的第一个输出应具有 (a) 未设置形状,或 (b) 秩为 1 且未设置 dim_value 也未设置 dim_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(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 类型

If - 16

版本

  • 名称: If (GitHub)

  • : main

  • 起始版本: 16

  • 函数: False

  • 支持级别: SupportType.COMMON

  • 形状推断: True

此版本的操作符从版本 16 开始可用。

摘要

条件 If

属性

  • else_branch - 图 (GRAPH) (必需)

    条件为假时运行的图。有 N 个输出:希望活出到封闭范围的值。输出数量必须与 then_branch 中的输出数量匹配。

  • then_branch - 图 (GRAPH) (必需)

    条件为真时运行的图。有 N 个输出:希望活出到封闭范围的值。输出数量必须与 else_branch 中的输出数量匹配。

输入

  • cond (异构) - B

    If 的条件。张量必须包含一个元素。

输出

输出数量介于 1 和 2147483647 之间。

  • outputs (可变参数) - V

    活出到封闭范围的值。 then_branchelse_branch 中的返回值必须是相同的数据类型。 then_branchelse_branch 可以生成具有相同元素类型但形状不同的张量。如果 then-branch 和 else-branch 的对应输出具有静态形状 S1 和 S2,则 if-node 的对应输出变量(如果存在)的形状必须与 S1 和 S2 都兼容,因为它表示两种可能形状的并集。例如,如果在模型文件中,then_branch 的第一个输出是形状为 [2] 的浮点张量,而 else_branch 的第一个输出是形状为 [3] 的另一个浮点张量,则 If 的第一个输出应具有 (a) 未设置形状,或 (b) 秩为 1 且未设置 dim_value 也未设置 dim_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

  • 起始版本: 13

  • 函数: False

  • 支持级别: SupportType.COMMON

  • 形状推断: True

此版本的操作符从版本 13 开始可用。

摘要

条件 If

属性

  • else_branch - 图 (GRAPH) (必需)

    条件为假时运行的图。有 N 个输出:希望活出到封闭范围的值。输出数量必须与 then_branch 中的输出数量匹配。

  • then_branch - 图 (GRAPH) (必需)

    条件为真时运行的图。有 N 个输出:希望活出到封闭范围的值。输出数量必须与 else_branch 中的输出数量匹配。

输入

  • cond (异构) - B

    If 的条件。张量必须包含一个元素。

输出

输出数量介于 1 和 2147483647 之间。

  • outputs (可变参数) - V

    活出到封闭范围的值。 then_branchelse_branch 中的返回值必须是相同的数据类型。 then_branchelse_branch 可以生成具有相同元素类型但形状不同的张量。如果 then-branch 和 else-branch 的对应输出具有静态形状 S1 和 S2,则 if-node 的对应输出变量(如果存在)的形状必须与 S1 和 S2 都兼容,因为它表示两种可能形状的并集。例如,如果在模型文件中,then_branch 的第一个输出是形状为 [2] 的浮点张量,而 else_branch 的第一个输出是形状为 [3] 的另一个浮点张量,则 If 的第一个输出应具有 (a) 未设置形状,或 (b) 秩为 1 且未设置 dim_value 也未设置 dim_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

  • 起始版本: 11

  • 函数: False

  • 支持级别: SupportType.COMMON

  • 形状推断: True

此版本的操作符从版本 11 开始可用。

摘要

条件 If

属性

  • else_branch - 图 (GRAPH) (必需)

    条件为假时运行的图。有 N 个输出:希望活出到封闭范围的值。输出数量必须与 then_branch 中的输出数量匹配。

  • then_branch - 图 (GRAPH) (必需)

    条件为真时运行的图。有 N 个输出:希望活出到封闭范围的值。输出数量必须与 else_branch 中的输出数量匹配。

输入

  • cond (异构) - B

    If 的条件。张量必须包含一个元素。

输出

输出数量介于 1 和 2147483647 之间。

  • outputs (可变参数) - V

    活出到封闭范围的值。 then_branchelse_branch 中的返回值必须是相同的数据类型。 then_branchelse_branch 可以生成具有相同元素类型但形状不同的张量。如果 then-branch 和 else-branch 的对应输出具有静态形状 S1 和 S2,则 if-node 的对应输出变量(如果存在)的形状必须与 S1 和 S2 都兼容,因为它表示两种可能形状的并集。例如,如果在模型文件中,then_branch 的第一个输出是形状为 [2] 的浮点张量,而 else_branch 的第一个输出是形状为 [3] 的另一个浮点张量,则 If 的第一个输出应具有 (a) 未设置形状,或 (b) 秩为 1 且未设置 dim_value 也未设置 dim_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

  • 起始版本: 1

  • 函数: False

  • 支持级别: SupportType.COMMON

  • 形状推断: True

此版本的操作符从版本 1 开始可用。

摘要

条件 If

属性

  • else_branch - 图 (GRAPH) (必需)

    条件为假时运行的图。有 N 个输出:希望活出到封闭范围的值。输出数量必须与 then_branch 中的输出数量匹配。

  • then_branch - 图 (GRAPH) (必需)

    条件为真时运行的图。有 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 类型