MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / BumpIndices

Method BumpIndices

tensorflow/compiler/xla/index_util.cc:116–129  ·  view source on GitHub ↗

static */

Source from the content-addressed store, hash-verified

114}
115
116/* static */ bool IndexUtil::BumpIndices(const Shape& shape,
117 absl::Span<int64> indices) {
118 for (int64 dimno = indices.size() - 1; dimno >= 0; --dimno) {
119 int64 limit = shape.dimensions(dimno);
120 if (indices[dimno] + 1 < limit) {
121 indices[dimno]++;
122 // Whenever an index of a dimension is increased, it means that all
123 // following dimensions have maxed out, so they must go to 0.
124 std::fill(indices.begin() + dimno + 1, indices.end(), 0);
125 return true;
126 }
127 }
128 return false;
129}
130
131/* static */ int64 IndexUtil::GetDimensionStride(const Shape& shape,
132 int64 dimension) {

Callers

nothing calls this directly

Calls 5

fillFunction · 0.50
sizeMethod · 0.45
dimensionsMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected