目录

GetDim

Function Description

Obtains the dimension value of the corresponding idx axis.

Function 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.

Return Value

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.

Calling Example

Shape shape0({3, 256, 256});
auto dim0 = shape0.GetDim(0); // 3
auto invalid_dim = shape0.GetDim(kMaxDimNum); // kInvalidDimValue