If¶
If - 24¶
版本¶
名称: If (GitHub)
域:
main起始版本:
24函数:
False支持级别:
SupportType.COMMON形状推断:
True
此版本的操作符已可用于版本 24 及以上。
摘要¶
If 条件
属性¶
else_branch - GRAPH (必填)
如果条件为 false 时运行的图。有 N 个输出:你希望在封闭范围内保持活动状态的值。输出的数量必须与 then_branch 中的输出数量匹配。
then_branch - GRAPH (必填)
如果条件为 true 时运行的图。有 N 个输出:你希望在封闭范围内保持活动状态的值。输出的数量必须与 else_branch 中的输出数量匹配。
输入¶
cond (异构) - B
If 的条件。张量必须包含单个元素。
输出¶
介于 1 到 2147483647 之间数量的输出。
outputs (可变参数) - 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))所有 Tensor、Sequence(Tensor)、Optional(Tensor) 和 Optional(Sequence(Tensor)) 类型,最高支持 IRv11。
B 包含 (
tensor(bool))仅布尔类型
If - 23¶
版本¶
名称: If (GitHub)
域:
main起始版本:
23函数:
False支持级别:
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_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))所有 Tensor、Sequence(Tensor)、Optional(Tensor) 和 Optional(Sequence(Tensor)) 类型,最高支持 IRv11。
B 包含 (
tensor(bool))仅布尔类型
If - 21¶
版本¶
名称: If (GitHub)
域:
mainsince_version:
21函数:
False支持级别:
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_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))所有 Tensor、Sequence(Tensor)、Optional(Tensor) 和 Optional(Sequence(Tensor)) 类型,最高支持 IRv10。
B 包含 (
tensor(bool))仅布尔类型
If - 19¶
版本¶
名称: If (GitHub)
域:
mainsince_version:
19函数:
False支持级别:
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_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))所有 Tensor、Sequence(Tensor)、Optional(Tensor) 和 Optional(Sequence(Tensor)) 类型,最高支持 IRv9。
B 包含 (
tensor(bool))仅布尔类型
If - 16¶
版本¶
名称: If (GitHub)
域:
mainsince_version:
16函数:
False支持级别:
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_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(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(int16)),seq(tensor(int32)),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(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)) 类型,最高支持 IRv4。
B 包含 (
tensor(bool))仅布尔类型
If - 13¶
版本¶
名称: If (GitHub)
域:
main起始版本:
13函数:
False支持级别:
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_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(int4),tensor(int64),tensor(int8),tensor(string),tensor(uint16),tensor(uint32),tensor(uint4),tensor(uint64),tensor(uint8))所有 Tensor 和 Sequence 类型
B 包含 (
tensor(bool))仅布尔类型
If - 11¶
版本¶
名称: If (GitHub)
域:
main起始版本:
11函数:
False支持级别:
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_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(uint4),tensor(uint64),tensor(uint8))所有 Tensor 类型
B 包含 (
tensor(bool))仅布尔类型
If - 1¶
版本¶
名称: If (GitHub)
域:
main起始版本:
1函数:
False支持级别:
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_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(uint4),tensor(uint64),tensor(uint8))所有 Tensor 类型
B 包含 (
tensor(bool))仅布尔类型