Operator Overloading
Product Support
Product |
Supported |
|---|---|
√ |
|
√ |
|
x |
|
x |
|
x |
|
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); |
Parent topic: Layout