aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/compiler/xla/shape_util.cc
diff options
context:
space:
mode:
authorGravatar Benjamin Kramer <kramerb@google.com>2018-07-10 08:20:45 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-07-10 08:23:37 -0700
commit8a6ef2cb4f98bacc1f821f60c21914b4bd5faaef (patch)
treea3307066f68c8673faba2b515ae698c3e99d2f31 /tensorflow/compiler/xla/shape_util.cc
parent842908d5556b0f099a8a23ad2ded8e446eb63583 (diff)
[XLA] Re-implement ShapeIndexView on top of ArraySlice
This simplifies the implementation quite a bit. While there add ConsumeBack. PiperOrigin-RevId: 203949710
Diffstat (limited to 'tensorflow/compiler/xla/shape_util.cc')
-rw-r--r--tensorflow/compiler/xla/shape_util.cc20
1 files changed, 3 insertions, 17 deletions
diff --git a/tensorflow/compiler/xla/shape_util.cc b/tensorflow/compiler/xla/shape_util.cc
index 101881f2f5..f4668c0f55 100644
--- a/tensorflow/compiler/xla/shape_util.cc
+++ b/tensorflow/compiler/xla/shape_util.cc
@@ -46,28 +46,14 @@ namespace xla {
using ::tensorflow::strings::StrAppend;
using ::tensorflow::strings::StrCat;
-string ShapeIndex::ToString() const {
- return StrCat("{", tensorflow::str_util::Join(indices_, ","), "}");
-}
+string ShapeIndex::ToString() const { return ShapeIndexView(*this).ToString(); }
string ShapeIndexView::ToString() const {
- return StrCat("{",
- tensorflow::str_util::Join(
- tensorflow::gtl::make_range(begin_, end_), ","),
- "}");
+ return StrCat("{", tensorflow::str_util::Join(indices_, ","), "}");
}
bool ShapeIndexView::operator==(const ShapeIndexView& other) const {
- if (size() != other.size()) {
- return false;
- }
- for (auto it = begin(), other_it = other.begin(); it != end();
- ++it, ++other_it) {
- if (*it != *other_it) {
- return false;
- }
- }
- return true;
+ return indices_ == other.indices_;
}
bool ShapeIndexView::operator!=(const ShapeIndexView& other) const {