Operator Overloading

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

Overloads the () operator. The internal implementation is to call the Crd2Idx API to convert multidimensional coordinates to a memory location index based on the layout.

Prototype

1
2
template <typename CoordType>
__aicore__ inline constexpr auto operator()(const CoordType& coord) const {}

Parameters

Parameter

Input/Output

Description

coord

Input

Coord structure type, which is used to indicate the coordinates of a tensor in different dimensions.

Returns

Returns the index value converted based on the coordinate information.

Restrictions

None

Examples

1
2
3
...
auto layout = AscendC::MakeLayout(shape, stride);
auto index = layout(coord);