FilesLast commitLast update
13 days ago
1 month ago
8 months ago
18 days ago
1 year ago
5 months ago
10 months ago
1 month ago
6 days ago
README

Flatten

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: flattens the input Tensor into a 2D Tensor based on the given axis.
  • Computation formula:
    • If the shape of the input self is (d₀, d₁, ..., dₙ), the shape of the output out is (d₀×d₁×...×dₐₓᵢₛ₋₁, dₐₓᵢₛ×dₐₓᵢₛ₊₁×...×dₙ)
    • If axis is 0, the shape of the output out is (1, d₀×d₁×...×dₙ)

Parameter Description

Parameter Name Input/Output/Attribute Description Data Type Data Format
self Input tensor Input tensor. Non-contiguous Tensors are supported, 2D to 8D. INT8, INT16, INT32, INT64, UINT8, UINT16, UINT32, UINT64, BOOL, BFLOAT16, FLOAT, FLOAT16 ND
axis Input attribute Reference axis for the flatten computation. The value range is [-self.dim(), self.dim()-1]. Currently only axis = 1 is supported. INT64 -
out Output tensor Output 2D tensor. Non-contiguous Tensors are supported. INT8, INT16, INT32, INT64, UINT8, UINT16, UINT32, UINT64, BOOL, BFLOAT16, FLOAT, FLOAT16 ND

Constraint Description

  • The number of dimensions of the input tensor cannot be greater than 8.
  • axis must be within the valid dimension range.
  • The input and output must have the same data type.

Invocation Description

Invocation Method Sample Code Description
aclnn API test_aclnn_flatten Invokes the Flatten operator through the aclnnFlatten API.