If¶
If - 25¶
版本¶
名称:If (GitHub)
域:
mainsince_version:
25函数:
False支持级别:
SupportType.COMMON形状推断:
True
此版本的操作符已在版本 25 及之后可用。
摘要¶
If 条件
属性¶
else_branch - GRAPH (必填)
条件为假时运行的图。有 N 个输出:你希望在封闭范围内生效的值。输出数量必须与 then_branch 中的输出数量匹配。
then_branch - GRAPH (必填)
条件为真时运行的图。有 N 个输出:你希望在封闭范围内生效的值。输出数量必须与 else_branch 中的输出数量匹配。
输入¶
cond (异构) - B
If 的条件。张量必须包含单个元素。
输出¶
1 到 2147483647 个输出之间。
输出 (可变) - V
在封闭范围内生效的值。`then_branch` 和 `else_branch` 中的返回值必须具有相同的数据类型。`then_branch` 和 `else_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(float8e8m0)),optional(tensor(int16)),optional(tensor(int2)),optional(tensor(int32)),optional(tensor(int4)),optional(tensor(int64)),optional(tensor(int8)),optional(tensor(string)),optional(tensor(uint16)),optional(tensor(uint2)),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(float8e8m0)),seq(tensor(int16)),seq(tensor(int2)),seq(tensor(int32)),seq(tensor(int4)),seq(tensor(int64)),seq(tensor(int8)),seq(tensor(string)),seq(tensor(uint16)),seq(tensor(uint2)),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(float8e8m0),tensor(int16),tensor(int2),tensor(int32),tensor(int4),tensor(int64),tensor(int8),tensor(string),tensor(uint16),tensor(uint2),tensor(uint32),tensor(uint4),tensor(uint64),tensor(uint8))所有张量、序列(张量)、可选(张量)和可选(序列(张量))类型,直到 IRv13。
B 在 (
tensor(bool))仅布尔
If - 24¶
版本¶
名称:If (GitHub)
域:
main起始版本:
24函数:
False支持级别:
SupportType.COMMON形状推断:
True
此版本的操作符已可用于版本 24 及以上。
摘要¶
If 条件
属性¶
else_branch - GRAPH (必填)
条件为假时运行的图。有 N 个输出:你希望在封闭范围内生效的值。输出数量必须与 then_branch 中的输出数量匹配。
then_branch - GRAPH (必填)
条件为真时运行的图。有 N 个输出:你希望在封闭范围内生效的值。输出数量必须与 else_branch 中的输出数量匹配。
输入¶
cond (异构) - B
If 的条件。张量必须包含单个元素。
输出¶
1 到 2147483647 个输出之间。
输出 (可变) - V
在封闭范围内生效的值。`then_branch` 和 `else_branch` 中的返回值必须具有相同的数据类型。`then_branch` 和 `else_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(float8e8m0)),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(float8e8m0)),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(float8e8m0)),tensor(int16)),tensor(int32)),tensor(int4)),tensor(int64)),tensor(int8)),tensor(string)),tensor(uint16)),tensor(uint32)),tensor(uint4)),tensor(uint64)),tensor(uint8))所有张量、序列(张量)、可选(张量)和可选(序列(张量))类型,直到 IRv11。
B 在 (
tensor(bool))仅布尔
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 个输出之间。
输出 (可变) - V
在封闭范围内生效的值。`then_branch` 和 `else_branch` 中的返回值必须具有相同的数据类型。`then_branch` 和 `else_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。
B 在 (
tensor(bool))仅布尔
If - 21¶
版本¶
名称:If (GitHub)
域:
mainsince_version:
21函数:
False支持级别:
SupportType.COMMON形状推断:
True
此版本的操作符自 版本 21 起可用。
摘要¶
If 条件
属性¶
else_branch - GRAPH (必填)
条件为假时运行的图。有 N 个输出:你希望在封闭范围内生效的值。输出数量必须与 then_branch 中的输出数量匹配。
then_branch - GRAPH (必填)
条件为真时运行的图。有 N 个输出:你希望在封闭范围内生效的值。输出数量必须与 else_branch 中的输出数量匹配。
输入¶
cond (异构) - B
If 的条件。张量必须包含单个元素。
输出¶
1 到 2147483647 个输出之间。
输出 (可变) - V
在封闭范围内生效的值。`then_branch` 和 `else_branch` 中的返回值必须具有相同的数据类型。`then_branch` 和 `else_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))所有张量、序列(张量)、可选(张量)和可选(序列(张量))类型,直到 IRv10。
B 在 (
tensor(bool))仅布尔
If - 19¶
版本¶
名称:If (GitHub)
域:
mainsince_version:
19函数:
False支持级别:
SupportType.COMMON形状推断:
True
此版本的操作符自 版本 19 起可用。
摘要¶
If 条件
属性¶
else_branch - GRAPH (必填)
条件为假时运行的图。有 N 个输出:你希望在封闭范围内生效的值。输出数量必须与 then_branch 中的输出数量匹配。
then_branch - GRAPH (必填)
条件为真时运行的图。有 N 个输出:你希望在封闭范围内生效的值。输出数量必须与 else_branch 中的输出数量匹配。
输入¶
cond (异构) - B
If 的条件。张量必须包含单个元素。
输出¶
1 到 2147483647 个输出之间。
输出 (可变) - V
在封闭范围内生效的值。`then_branch` 和 `else_branch` 中的返回值必须具有相同的数据类型。`then_branch` 和 `else_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(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(int64)),tensor(int8)),tensor(string)),tensor(uint16)),tensor(uint32)),tensor(uint4)),tensor(uint64)),tensor(uint8))所有张量、序列(张量)、可选(张量)和可选(序列(张量))类型,直到 IRv9。
B 在 (
tensor(bool))仅布尔
If - 16¶
版本¶
名称:If (GitHub)
域:
mainsince_version:
16函数:
False支持级别:
SupportType.COMMON形状推断:
True
此版本的运算符自 版本 16 起可用。
摘要¶
If 条件
属性¶
else_branch - GRAPH (必填)
条件为假时运行的图。有 N 个输出:你希望在封闭范围内生效的值。输出数量必须与 then_branch 中的输出数量匹配。
then_branch - GRAPH (必填)
条件为真时运行的图。有 N 个输出:你希望在封闭范围内生效的值。输出数量必须与 else_branch 中的输出数量匹配。
输入¶
cond (异构) - B
If 的条件。张量必须包含单个元素。
输出¶
1 到 2147483647 个输出之间。
输出 (可变) - V
在封闭范围内生效的值。`then_branch` 和 `else_branch` 中的返回值必须具有相同的数据类型。`then_branch` 和 `else_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(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))所有张量、序列(张量)、可选(张量)和可选(序列(张量))类型,直到 IRv4。
B 在 (
tensor(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 个输出之间。
输出 (可变) - V
在封闭范围内生效的值。`then_branch` 和 `else_branch` 中的返回值必须具有相同的数据类型。`then_branch` 和 `else_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 在 (
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))所有张量和序列类型
B 在 (
tensor(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 个输出之间。
输出 (可变) - V
在封闭范围内生效的值。`then_branch` 和 `else_branch` 中的返回值必须具有相同的数据类型。`then_branch` 和 `else_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 在 (
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))所有张量类型
B 在 (
tensor(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 个输出之间。
输出 (可变) - V
在封闭范围内生效的值。`then_branch` 和 `else_branch` 中的返回值必须具有相同的形状和数据类型。
类型约束¶
V 在 (
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))所有张量类型
B 在 (
tensor(bool))仅布尔