Operator Overloading

Product Support

Product

Supported

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

Function

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

Example

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