static */
| 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) { |
nothing calls this directly
no test coverage detected