operator[]
Function Usage
Obtains the step value of a specified idx axis.
Prototype
1 2 | const int64_t &operator[](const size_t idx) const int64_t &operator[](const size_t idx) |
Parameters
Parameter |
Input/Output |
Description |
|---|---|---|
idx |
Input |
Dimension index. You must ensure that the index is valid. |
Returns
- const int64_t &operator[](const size_t idx) const: step value. When idx is greater than or equal to kMaxDimNum, the behavior is not defined.
- int64_t &operator[](const size_t idx): dimension value. When idx is greater than or equal to kMaxDimNum, the behavior is not defined.
Constraints
You must ensure that the index is valid, that is, idx must be less than kMaxDimNum.
Examples
1 2 3 4 | Stride stride({3, 256, 256}); auto str0 = stride[0]; // 3 auto str5 = stride[5]; // 0 auto invalid_str = stride[Stride::kMaxDimNum]; // The behavior is not defined. |
Parent topic: Stride