GetStride

Function Usage

Obtains the step value of a corresponding idx axis.

Prototype

1
int64_t GetStride(const size_t idx) const

Parameters

Parameter

Input/Output

Description

idx

Input

Dimension index. You must ensure that the index is valid.

Returns

Step value. When idx is greater than or equal to kMaxDimNum, kInvalidStrideValue is returned.

Constraints

You must ensure that the idx is valid, that is, idx must be less than kMaxDimNum.

Examples

1
2
3
Stride stride({3, 256, 256});
auto stride0 = stride.GetStride(0); // 3
auto invalid_stride = stride.GetStride(Stride::kMaxDimNum); // kInvalidStrideValue