GetDim
Function Usage
Obtains the dimension value of the corresponding idx axis.
Prototype
1 | 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.
Constraints
You must ensure that the index is valid, that is, idx must be less than kMaxDimNum.
Examples
1 2 3 | Shape shape0({3, 256, 256}); auto dim0 = shape0.GetDim(0); // 3 auto invalid_dim = shape0.GetDim(kMaxDimNum); // kInvalidDimValue |
Parent topic: Shape