FilesLast commitLast update
10 days ago
19 days ago
19 days ago
19 days ago
19 days ago
19 days ago
10 days ago
README

Merge

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

Merge is a basic control flow operator. It forwards the first tensor in the input x that becomes available to the output y, and gives the index of this tensor in the inputs in value_index. Merge usually works with the Switch operator to implement branch convergence: Switch distributes data to different branches based on conditions, and then Merge converges the data of the available branches back to the main flow.

Parameter Description

Parameter Name Input/Output/Attribute Description Data Type Data Format
x Dynamic input Input tensors, one of which becomes available. All input tensors should use the same data type; shape inference merges the dimension information of all inputs. float16, float32, float64, int8, int16, int32, int64, uint8, uint16, uint32, uint64, bool ND
y Output Available tensor, whose data type is consistent with that of x. float16, float32, float64, int8, int16, int32, int64, uint8, uint16, uint32, uint64, bool ND
value_index Output Scalar, which is the index of the selected input tensor in the input list. DT_INT32 ND

Constraint Description

  • The number of inputs x must be greater than or equal to 1; otherwise, shape inference fails.
  • The data types of all inputs x must be the same; data type inference checks the input types one by one and returns a failure if they are inconsistent. The data type of the output y is the same as that of the inputs, and value_index is DT_INT32.
  • If the numbers of dimensions of inputs x are inconsistent or there is an unknown-rank input, the output y is inferred as unknown rank ([-2]), and inference failure is not returned due to inconsistent ranks.
  • For a dimension, if the values of the inputs are inconsistent or there is an unknown dimension (-1), the dimension is inferred as -1 (unknown).

Invocation Description

The Merge operator is a basic control flow operator. It is usually used as a branch convergence node in a graph and is not invoked separately.

Invocation Method Invocation Sample Description
Graph-mode invocation test_geir_merge Invokes the Merge operator by building a graph through the operator IR