FilesLast commitLast update
21 days ago
5 months ago
21 days ago
21 days ago
5 months ago
21 days ago
12 days ago
README

ShapeN

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: returns the shapes of multiple input tensors. Each input corresponds to one output, and the output is a 1-dimensional tensor composed of the dimension values of the corresponding input.

  • Computation logic:

    • N tensors are input, and the rank of the i-th tensor is r_i
    • The output is N 1-dimensional tensors. The length of the i-th output is r_i, and its content is the dimension values of the i-th input
  • Example:

    Input: x0 = float32[2, 3], x1 = float32[4, 5, 6]
    Output: y0 = int32[2] = [2, 3], y1 = int32[3] = [4, 5, 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 obtained. DOUBLE, FLOAT, FLOAT16, INT8, INT16, UINT8, UINT16, INT32, UINT32, INT64, UINT64, BOOL, STRING ND
y Dynamic output Corresponds to the inputs one by one. Each output is a 1-dimensional tensor composed of the dimension values of the corresponding input, and its length equals the rank of the corresponding input. INT32, INT64 ND
dtype Attribute Data type of the output tensor. If it is omitted, the default value is INT32. INT32, INT64 -

Constraint Description

  • The dtype attribute supports only INT32 and INT64. The operator inference fails if another value is used.
  • When any input has an unknown rank (-2), the corresponding output is 1-dimensional with an unknown shape (-1).
  • Only the ND format is supported for the input.

Invocation Description

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