FilesLast commitLast update
15 days ago
15 days ago
15 days ago
15 days ago
15 days ago
15 days ago
5 days ago
README

GatherShapes

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: collects the specified dimension values from the shapes of multiple input tensors and concatenates them into a one-dimensional tensor output in the order of axes.

  • Computation logic:

    • Each element in axes is a two-element tuple [input_index, dim_index], which indicates taking the dim_index-th dimension value of the input_index-th input
    • The output is a one-dimensional tensor whose length equals the number of elements of axes and whose content is the dimension values collected by axes
  • Example:

    Input: x0 = float32[2, 3], x1 = float32[4, 5, 6], axes = [[0,0],[0,1],[1,2]]
    Output: shape = int32[3] = [2, 3, 6]
    

Parameter Description

Parameter Name Input/Output/Attribute Description Data Type Data Format
x Dynamic input List of input tensors whose shape information is to be collected. Any data type ND
shape Output One-dimensional tensor composed of the input dimension values collected by axes. Its length equals the number of elements of axes. INT32, INT64 ND
axes Attribute Required. List of two-element tuples. Each element [input_index, dim_index] specifies collecting the dim_index-th dimension value of the input_index-th input. ListListInt (list of int64 two-element tuples) -
dtype Attribute Data type of the output tensor. By default, INT32 is used when it is omitted. INT32, INT64 -

Constraint Description

  • axes cannot be empty, and each element must be a two-element tuple. input_index and dim_index cannot be out of bounds (this check is skipped when there are inputs with unknown rank).
  • The dtype attribute supports only INT32 and INT64. Operator inference fails for other values.
  • Only the ND format is supported for inputs.

Invocation Description

Invocation Method Invocation Sample Description
Graph-mode invocation test_geir_gather_shapes Invokes the GatherShapes operator by building a graph through the operator IR.