GetStride

Supported Products

Product

Supported (√/x)

Atlas A3 training products/Atlas A3 inference products

Atlas A2 training products/Atlas A2 inference products

Atlas 200I/500 A2 inference products

x

Atlas inference product's AI Core

x

Atlas inference product's Vector Core

x

Atlas training products

x

Functions

Returns the Stride object that describes the memory access stride, which corresponds to the dimension information of the shape.

Prototype

1
2
__aicore__ inline constexpr decltype(auto) GetStride() {}    
__aicore__ inline constexpr decltype(auto) GetStride() const {}

Command-Line Options

None

Return Value Description

The Stride object that describes the memory access stride. The Stride structure type is an alias of the Std::tuple type and is defined as follows:

1
2
template <typename... Strides>
using Stride = Std::tuple<Strides...>;

Restrictions

None

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
// Initialize the Layout data structure and obtain the corresponding value.
AscendC::Shape<int,int,int> shape = AscendC::MakeShape(10, 20, 30);
AscendC::Stride<int,int,int> stride = AscendC::MakeStride(1, 100, 200);

auto layoutMake = AscendC::MakeLayout(shape, stride);
AscendC::Layout<AscendC::Shape<int, int, int>, AscendC::Stride<int, int, int>> layoutInit(shape, stride);

int value = AscendC::Std::get<0>(layoutInit.GetStride()); // value = 1
value = AscendC::Std::get<1>(layoutInit.GetStride()); // value = 100
value = AscendC::Std::get<2>(layoutInit.GetStride()); // value = 200