如果¶
如果 - 23¶
版本¶
名称: If (GitHub)
域名:
mainsince_version:
23函数:
Falsesupport_level:
SupportType.COMMON形状推断:
True
此版本的运算符自版本23起可用。
摘要¶
如果条件
属性¶
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,或 © 形状为秩 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)) 中:仅布尔值
如果 - 21¶
版本¶
名称: If (GitHub)
域名:
mainsince_version:
21函数:
Falsesupport_level:
SupportType.COMMON形状推断:
True
此版本的运算符自版本21起可用。
摘要¶
如果条件
属性¶
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,或 © 具有唯一dim_param的秩 1 形状。相比之下,第一个输出不能具有形状 [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)) 中:仅布尔值
如果 - 19¶
版本¶
名称: If (GitHub)
域名:
mainsince_version:
19函数:
Falsesupport_level:
SupportType.COMMON形状推断:
True
此版本的运算符自版本19起可用。
总结¶
如果条件
属性¶
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,或 © 具有唯一dim_param的秩 1 形状。相比之下,第一个输出不能具有形状 [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)) 中:仅布尔值
如果 - 16¶
版本¶
名称: If (GitHub)
域名:
mainsince_version:
16函数:
Falsesupport_level:
SupportType.COMMON形状推断:
True
此版本的运算符自版本16起可用。
摘要¶
如果条件
属性¶
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,或 © 具有唯一dim_param的秩 1 形状。相比之下,第一个输出不能具有形状 [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)):所有Tensor、Sequence(Tensor)、Optional(Tensor)和Optional(Sequence(Tensor))类型,直到IRv4。
B 在 (
tensor(bool)) 中:仅布尔值
如果 - 13¶
版本¶
名称: If (GitHub)
域名:
mainsince_version:
13函数:
Falsesupport_level:
SupportType.COMMON形状推断:
True
此版本的运算符自版本13起可用。
摘要¶
如果条件
属性¶
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,或 © 形状为秩 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)) 中:仅布尔值
如果 - 11¶
版本¶
名称: If (GitHub)
域名:
mainsince_version:
11函数:
Falsesupport_level:
SupportType.COMMON形状推断:
True
此版本的运算符自版本11起可用。
摘要¶
如果条件
属性¶
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,或 © 具有唯一dim_param的秩 1 形状。相比之下,第一个输出不能具有形状 [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)) 中:仅布尔值
如果 - 1¶
版本¶
名称: If (GitHub)
域名:
mainsince_version:
1函数:
Falsesupport_level:
SupportType.COMMON形状推断:
True
此版本的运算符自版本1起可用。
总结¶
如果条件
属性¶
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)) 中:仅布尔值