Layout Constructor

Applicability

Product

Supported

Atlas 350 Accelerator Card

x

Atlas A3 training product/Atlas A3 inference product

Atlas A2 training product/Atlas A2 inference product

Atlas 200I/500 A2 inference product

x

Atlas inference product AI Core

x

Atlas inference product Vector Core

x

Atlas training product

x

Function Usage

Instantiates a Layout object based on the input Shape and Stride objects.

Prototype

1
__aicore__ inline constexpr Layout(const ShapeType& shape  = {}, const StrideType& stride = {}) : Std::tuple<ShapeType, StrideType>(shape, stride)

Parameters

Parameter

Input/Output

Description

shape

Input

Std::tuple structure type, which is used to define the logical shape of data, such as the number of rows and columns in a two-dimensional matrix or the size of each dimension in a multi-dimensional tensor.

stride

Input

Std::tuple structure type, which is used to define the stride size of each dimension in memory, that is, the interval between adjacent elements in the same dimension in memory. The interval is measured in elements and corresponds to the dimension information of the shape.

Returns

None

Restrictions

The Shape and Stride structures passed during the construction of the Layout object must be of the Std::tuple type and meet the usage restrictions of the Std::tuple structure type.

Examples

1
2
3
4
AscendC::Shape<int,int,int> shape = AscendC::MakeShape(10, 20, 30);
AscendC::Stride<int,int,int> stride = AscendC::MakeStride(1, 100, 200);

AscendC::Layout<AscendC::Shape<int, int, int>, AscendC::Stride<int, int, int>> layoutInit(shape, stride);