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

Shape

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 shape of the input tensor, that is, a 1-dimensional tensor composed of the dimension values of the input.

  • Computation logic:

    • The rank of the input tensor is r
    • The output is a 1-dimensional tensor with the length of r, and its content is the dimension values of the input tensor
  • Example:

    Input: x = float32[2, 3, 4]
    Output: y = int32[3] = [2, 3, 4]
    

Parameter Description

Parameter Name Input/Output/Attribute Description Data Type Data Format
x Input Input tensor whose shape information is to be obtained. Any data type ND
y Output 1-dimensional tensor composed of the dimension values of the input tensor. Its length equals the rank of the 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 the input has an unknown rank (-2), the 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 Invokes the Shape operator by building a graph through the operator IR.