GetDim
Description
Obtains the dimension value of the corresponding idx axis.
Prototype
int64_t GetDim(const size_t idx) const
Parameters
Parameter |
Input/Output |
Description |
|---|---|---|
idx |
Input |
Index of dim. You must ensure that the index is valid. |
Returns
Value of dim. When idx is greater than or equal to kMaxDimNum, `kInvalidDimValue` is returned.
Restrictions
You must ensure that the index is valid, that is, idx must be less than kMaxDimNum.
Example
Shape shape0({3, 256, 256});
auto dim0 = shape0.GetDim(0); // 3
auto invalid_dim = shape0.GetDim(kMaxDimNum); // kInvalidDimValue
Parent topic: Shape