25template <
int N>
struct Dims
34 for (
int i = 0; i < 4; i++)
45 for (
int i = 0; i < 4; i++)
47 int src = (int)shape.
dimensions.size() - i - 1;
56 for (
int i = 1; i < 4; i++)
78 DCHECK(index >= 0 && index < N);
79 return array.
sizes[index];
86 for (
int i = 0; i < N; ++i)
88 flat_size *= dims.
sizes[i];
97 for (
int i = 0; i < 4; i++)
101 return max_offset + 1;
110 for (
int i = 0; i < N; ++i)
122 for (
int i = 0; i < N; ++i)
134 for (
int i = 0; i < N; ++i)
138 return FlatSize(dims, check_dims_1, check_dims_2);
147 for (
int i = 0; i < N; ++i)
151 return FlatSize(dims, check_dims_1, check_dims_2, check_dims_3);
157 int expected_stride = 1;
158 for (
int d = 0; d < N; d++)
160 if (dims.
strides[d] != expected_stride)
162 expected_stride *= dims.
sizes[d];
int RequiredBufferSizeForDims(const Dims< 4 > &dims)
int Offset(const Dims< 4 > &dims, int i0, int i1, int i2, int i3)
int ArraySize(const Dims< N > &array, int index)
bool IsPackedWithoutStrides(const Dims< N > &dims)
int FlatSize(const Dims< N > &dims)
int MatchingFlatSize(const Dims< N > &dims, const Dims< N > &check_dims_0)
Dims< 4 > convertShapeToDims(const Shape &shape)
#define DCHECK(condition)
uint32_t getSizeOfDimension(const Shape &shape, uint32_t dimensionIdx)
std::vector< uint32_t > dimensions