If
English | 简体中文
Product Support Status
| Product | Supported |
|---|---|
| Ascend 950PR&950DT products | √ |
| Atlas A3 products | √ |
| Atlas A2 products | √ |
| Atlas 200I/500 A2 inference products | √ |
| Atlas inference products | √ |
| Atlas training products | √ |
Function Description
- Operator function: selects and executes the
then_branchorelse_branchsubgraph based on the value of the Boolean conditioncond, passes the input tensors to the selected subgraph, and returns its output tensors.
Parameter Description
| Parameter Name | Input/Output/Attribute | Description | Data Type | Data Format |
|---|---|---|---|---|
cond |
Input | Boolean condition for selecting a subgraph branch. | All types | ND |
input |
Input (dynamic) | Input tensors passed to the selected subgraph, which support dynamic inputs. | All types | ND |
then_branch |
Subgraph | Subgraph executed when the condition is true. It receives input and returns a group of tensors. |
- | - |
else_branch |
Subgraph | Subgraph executed when the condition is false. It receives input and returns a group of tensors. |
- | - |
output |
Output (dynamic) | Output tensors returned by the selected subgraph, which support dynamic outputs. | All types | ND |
Constraint Description
- The output shape and data type are determined by the subgraph actually executed at runtime, and are not inferred at compilation.
- The output types of the subgraphs in
then_branchandelse_branchmust be consistent.
Invocation Description
| Invocation Method | Invocation Sample | Description |
|---|---|---|
| Graph-mode invocation | test_geir_if | Invokes the If operator by building a graph through the operator IR. |