aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/compiler/xla/shape_util.cc
diff options
context:
space:
mode:
Diffstat (limited to 'tensorflow/compiler/xla/shape_util.cc')
-rw-r--r--tensorflow/compiler/xla/shape_util.cc30
1 files changed, 0 insertions, 30 deletions
diff --git a/tensorflow/compiler/xla/shape_util.cc b/tensorflow/compiler/xla/shape_util.cc
index 4c079c87d4..745491e485 100644
--- a/tensorflow/compiler/xla/shape_util.cc
+++ b/tensorflow/compiler/xla/shape_util.cc
@@ -1218,34 +1218,4 @@ ShapeUtil::DimensionsUnmodifiedByReshape(const Shape& input_shape,
return shape;
}
-/* static */ void ShapeUtil::ForEachIndex(
- const Shape& shape, tensorflow::gtl::ArraySlice<int64> base,
- tensorflow::gtl::ArraySlice<int64> count,
- tensorflow::gtl::ArraySlice<int64> incr,
- const IndexVisitorFunction& visitor_function) {
- if (ShapeUtil::HasZeroElements(shape)) {
- return;
- }
- DCHECK_EQ(Rank(shape), base.size());
- DCHECK_EQ(incr.size(), base.size());
- DCHECK_EQ(count.size(), base.size());
- const Layout& layout = shape.layout();
- int64 rank = layout.minor_to_major_size();
- // Allows handling R0 arrays, such that the visitor function will be called
- // once with the proper empty indexes.
- int64 n = -1;
- std::vector<int64> indexes(base.begin(), base.end());
- while (n < rank && visitor_function(indexes)) {
- // Increments dimensions in minor to major order.
- for (n = 0; n < rank; ++n) {
- int64 dim = layout.minor_to_major(n);
- indexes[dim] += incr[dim];
- if (indexes[dim] < base[dim] + count[dim]) {
- break;
- }
- indexes[dim] = base[dim];
- }
- }
-}
-
} // namespace xla