aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Tim Shen <timshen@google.com>2018-08-27 17:29:40 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-08-27 17:33:02 -0700
commitc7173ca08a06145439362280517bd1e741ee8c7b (patch)
treeb5048468d1da11a45fd8bd7c9b37577388a14b1c
parent1e1cf3ea4fa161727ba5fed5fad05ed1b243fcef (diff)
Remove tensorflow::gtl::{Mutable,}ArraySlice's old API that don't show up in absl::Span, so that transitioning to the latter is easier.
PiperOrigin-RevId: 210461037
-rw-r--r--tensorflow/compiler/tf2xla/kernels/diag_op.cc2
-rw-r--r--tensorflow/compiler/tf2xla/kernels/select_op.cc2
-rw-r--r--tensorflow/compiler/tf2xla/lib/scatter.cc2
-rw-r--r--tensorflow/compiler/xla/service/elemental_ir_emitter.cc2
-rw-r--r--tensorflow/compiler/xla/shape_util.h4
-rw-r--r--tensorflow/compiler/xla/tools/dumped_computation_to_graphviz.cc2
-rw-r--r--tensorflow/compiler/xla/tools/dumped_computation_to_operation_list.cc2
-rw-r--r--tensorflow/compiler/xla/tools/dumped_computation_to_text.cc2
-rw-r--r--tensorflow/compiler/xla/tools/dumped_computation_to_tf_graphdef.cc2
-rw-r--r--tensorflow/compiler/xla/tools/replay_computation.cc2
-rw-r--r--tensorflow/compiler/xla/tools/show_signature.cc2
-rw-r--r--tensorflow/core/lib/gtl/array_slice.h7
-rw-r--r--tensorflow/core/lib/gtl/array_slice_test.cc14
13 files changed, 18 insertions, 27 deletions
diff --git a/tensorflow/compiler/tf2xla/kernels/diag_op.cc b/tensorflow/compiler/tf2xla/kernels/diag_op.cc
index ed44ad218b..70c3eaf66b 100644
--- a/tensorflow/compiler/tf2xla/kernels/diag_op.cc
+++ b/tensorflow/compiler/tf2xla/kernels/diag_op.cc
@@ -178,7 +178,7 @@ class MatrixDiagOp : public XlaOpKernel {
int last_dim = dims.size() - 1;
int64 last_dim_size = input_shape.dim_size(last_dim);
tensorflow::gtl::ArraySlice<int64> other_dims(dims);
- other_dims.pop_back();
+ other_dims.remove_suffix(1);
xla::XlaOp input = ctx->Input(0);
xla::XlaOp diag = CreateDiagonal(input, last_dim_size, other_dims,
diff --git a/tensorflow/compiler/tf2xla/kernels/select_op.cc b/tensorflow/compiler/tf2xla/kernels/select_op.cc
index 6ce50efb4a..d9578eca5b 100644
--- a/tensorflow/compiler/tf2xla/kernels/select_op.cc
+++ b/tensorflow/compiler/tf2xla/kernels/select_op.cc
@@ -67,7 +67,7 @@ class SelectOp : public XlaOpKernel {
// to get the dimensions in the right order.
const auto dim_sizes = then_shape.dim_sizes();
gtl::ArraySlice<int64> bdims = dim_sizes;
- bdims.pop_front();
+ bdims.remove_prefix(1);
cond_handle = xla::Broadcast(cond_handle, bdims);
std::vector<int64> dim_order(then_shape.dims());
diff --git a/tensorflow/compiler/tf2xla/lib/scatter.cc b/tensorflow/compiler/tf2xla/lib/scatter.cc
index ba22eff73a..bafe5099f2 100644
--- a/tensorflow/compiler/tf2xla/lib/scatter.cc
+++ b/tensorflow/compiler/tf2xla/lib/scatter.cc
@@ -58,7 +58,7 @@ xla::StatusOr<xla::XlaOp> XlaScatter(
") must be <= the rank of the buffer (shape: ",
xla::ShapeUtil::HumanString(buffer_shape), ")");
}
- indices_dims.pop_back();
+ indices_dims.remove_suffix(1);
}
int64 num_indices = 1;
diff --git a/tensorflow/compiler/xla/service/elemental_ir_emitter.cc b/tensorflow/compiler/xla/service/elemental_ir_emitter.cc
index 2e5930fb70..52faaab25c 100644
--- a/tensorflow/compiler/xla/service/elemental_ir_emitter.cc
+++ b/tensorflow/compiler/xla/service/elemental_ir_emitter.cc
@@ -899,7 +899,7 @@ StatusOr<llvm::Value*> ElementalIrEmitter::EmitErfInv(PrimitiveType prim_type,
auto multiply_add = [&](tensorflow::gtl::ArraySlice<float> coefficients,
llvm::Value* w) {
llvm::Value* p = getFloat(coefficients.front());
- coefficients.pop_front();
+ coefficients.remove_prefix(1);
for (float coefficient : coefficients) {
p = b_->CreateFAdd(b_->CreateFMul(p, w), getFloat(coefficient));
}
diff --git a/tensorflow/compiler/xla/shape_util.h b/tensorflow/compiler/xla/shape_util.h
index 84f36e48a0..83e58545bf 100644
--- a/tensorflow/compiler/xla/shape_util.h
+++ b/tensorflow/compiler/xla/shape_util.h
@@ -131,12 +131,12 @@ class ShapeIndexView {
}
ShapeIndexView ConsumeFront() const {
ShapeIndexView result = *this;
- result.indices_.pop_front();
+ result.indices_.remove_prefix(1);
return result;
}
ShapeIndexView ConsumeBack() const {
ShapeIndexView result = *this;
- result.indices_.pop_back();
+ result.indices_.remove_suffix(1);
return result;
}
ShapeIndex ToShapeIndex() const { return ShapeIndex(begin(), end()); }
diff --git a/tensorflow/compiler/xla/tools/dumped_computation_to_graphviz.cc b/tensorflow/compiler/xla/tools/dumped_computation_to_graphviz.cc
index f20dcef382..d15b71b792 100644
--- a/tensorflow/compiler/xla/tools/dumped_computation_to_graphviz.cc
+++ b/tensorflow/compiler/xla/tools/dumped_computation_to_graphviz.cc
@@ -78,7 +78,7 @@ int main(int argc, char** argv) {
tensorflow::port::InitMain(argv[0], &argc, &argv);
tensorflow::gtl::ArraySlice<char*> args(argv, argc);
- args.pop_front(); // Pop off the binary name, argv[0]
+ args.remove_prefix(1); // Pop off the binary name, argv[0]
xla::tools::RealMain(args);
return 0;
}
diff --git a/tensorflow/compiler/xla/tools/dumped_computation_to_operation_list.cc b/tensorflow/compiler/xla/tools/dumped_computation_to_operation_list.cc
index 72e5abd274..c446b27a04 100644
--- a/tensorflow/compiler/xla/tools/dumped_computation_to_operation_list.cc
+++ b/tensorflow/compiler/xla/tools/dumped_computation_to_operation_list.cc
@@ -105,7 +105,7 @@ int main(int argc, char** argv) {
tensorflow::port::InitMain(argv[0], &argc, &argv);
tensorflow::gtl::ArraySlice<char*> args(argv, argc);
- args.pop_front(); // Pop off the binary name, argv[0]
+ args.remove_prefix(1); // Pop off the binary name, argv[0]
xla::tools::RealMain(args);
return 0;
}
diff --git a/tensorflow/compiler/xla/tools/dumped_computation_to_text.cc b/tensorflow/compiler/xla/tools/dumped_computation_to_text.cc
index f03e1b1f96..d86a4474b3 100644
--- a/tensorflow/compiler/xla/tools/dumped_computation_to_text.cc
+++ b/tensorflow/compiler/xla/tools/dumped_computation_to_text.cc
@@ -103,7 +103,7 @@ int main(int argc, char** argv) {
QCHECK(argc > 1) << "\nERROR: must specify at least one module\n" << usage;
tensorflow::gtl::ArraySlice<char*> args(argv, argc);
- args.pop_front(); // Pop off the binary name, argv[0]
+ args.remove_prefix(1); // Pop off the binary name, argv[0]
xla::tools::RealMain(args, compile);
return 0;
}
diff --git a/tensorflow/compiler/xla/tools/dumped_computation_to_tf_graphdef.cc b/tensorflow/compiler/xla/tools/dumped_computation_to_tf_graphdef.cc
index dc5c106d02..bd8b89542f 100644
--- a/tensorflow/compiler/xla/tools/dumped_computation_to_tf_graphdef.cc
+++ b/tensorflow/compiler/xla/tools/dumped_computation_to_tf_graphdef.cc
@@ -79,7 +79,7 @@ int main(int argc, char** argv) {
tensorflow::port::InitMain(argv[0], &argc, &argv);
tensorflow::gtl::ArraySlice<char*> args(argv, argc);
- args.pop_front(); // Pop off the binary name, argv[0]
+ args.remove_prefix(1); // Pop off the binary name, argv[0]
xla::tools::RealMain(args);
return 0;
}
diff --git a/tensorflow/compiler/xla/tools/replay_computation.cc b/tensorflow/compiler/xla/tools/replay_computation.cc
index e776e6a4eb..e826d6fa93 100644
--- a/tensorflow/compiler/xla/tools/replay_computation.cc
+++ b/tensorflow/compiler/xla/tools/replay_computation.cc
@@ -345,6 +345,6 @@ int main(int argc, char** argv) {
}
tensorflow::gtl::ArraySlice<char*> args(argv, argc);
- args.pop_front(); // Pop off the binary name, argv[0]
+ args.remove_prefix(1); // Pop off the binary name, argv[0]
return xla::tools::RealMain(args, opts);
}
diff --git a/tensorflow/compiler/xla/tools/show_signature.cc b/tensorflow/compiler/xla/tools/show_signature.cc
index 4e53fafcc9..10e7202acf 100644
--- a/tensorflow/compiler/xla/tools/show_signature.cc
+++ b/tensorflow/compiler/xla/tools/show_signature.cc
@@ -67,7 +67,7 @@ int main(int argc, char** argv) {
tensorflow::port::InitMain(argv[0], &argc, &argv);
tensorflow::gtl::ArraySlice<char*> args(argv, argc);
- args.pop_front(); // Pop off the binary name, argv[0]
+ args.remove_prefix(1); // Pop off the binary name, argv[0]
xla::tools::RealMain(args);
return 0;
}
diff --git a/tensorflow/core/lib/gtl/array_slice.h b/tensorflow/core/lib/gtl/array_slice.h
index 4ecc96ee79..b773a65569 100644
--- a/tensorflow/core/lib/gtl/array_slice.h
+++ b/tensorflow/core/lib/gtl/array_slice.h
@@ -187,8 +187,6 @@ class ArraySlice {
void remove_prefix(size_type n) { impl_.remove_prefix(n); }
void remove_suffix(size_type n) { impl_.remove_suffix(n); }
- void pop_back() { remove_suffix(1); }
- void pop_front() { remove_prefix(1); }
// These relational operators have the same semantics as the
// std::vector<T> relational operators: they do deep (element-wise)
@@ -286,8 +284,6 @@ class MutableArraySlice {
void remove_prefix(size_type n) { impl_.remove_prefix(n); }
void remove_suffix(size_type n) { impl_.remove_suffix(n); }
- void pop_back() { remove_suffix(1); }
- void pop_front() { remove_prefix(1); }
bool operator==(ArraySlice<T> other) const {
return ArraySlice<T>(*this) == other;
@@ -296,9 +292,6 @@ class MutableArraySlice {
return ArraySlice<T>(*this) != other;
}
- // DEPRECATED(jacobsa): Please use data() instead.
- pointer mutable_data() const { return impl_.data(); }
-
private:
Impl impl_;
};
diff --git a/tensorflow/core/lib/gtl/array_slice_test.cc b/tensorflow/core/lib/gtl/array_slice_test.cc
index 4d3da85b88..c798a488cb 100644
--- a/tensorflow/core/lib/gtl/array_slice_test.cc
+++ b/tensorflow/core/lib/gtl/array_slice_test.cc
@@ -73,13 +73,13 @@ static void TestHelper(const IntSlice& vorig, const IntVec& vec) {
if (len > 0) {
EXPECT_EQ(0, v.front());
EXPECT_EQ(len - 1, v.back());
- v.pop_back();
+ v.remove_suffix(1);
EXPECT_EQ(len - 1, v.size());
for (size_t i = 0; i < v.size(); ++i) {
EXPECT_EQ(i, v[i]);
}
if (len > 1) {
- v.pop_front();
+ v.remove_prefix(1);
EXPECT_EQ(len - 2, v.size());
for (size_t i = 0; i < v.size(); ++i) {
EXPECT_EQ(i + 1, v[i]);
@@ -128,7 +128,7 @@ static void MutableTestHelper(const MutableIntSlice& vorig, int* ptr,
MutableIntSlice other; // To test the assignment return value.
MutableIntSlice v = other = vorig;
- EXPECT_EQ(ptr, v.mutable_data());
+ EXPECT_EQ(ptr, v.data());
int counter = 0;
for (MutableIntSlice::iterator it = v.begin(); it != v.end(); ++it) {
@@ -142,17 +142,17 @@ static void MutableTestHelper(const MutableIntSlice& vorig, int* ptr,
v[0] = 1;
v.front() = 2;
v.back() = 5;
- *v.mutable_data() = 4;
+ *v.data() = 4;
std::fill(v.begin(), v.end(), 5);
std::fill(v.rbegin(), v.rend(), 6);
// Test size-changing methods.
- v.pop_back();
+ v.remove_suffix(1);
EXPECT_EQ(len - 1, v.size());
for (size_t i = 0; i < v.size(); ++i) {
EXPECT_EQ(ptr + i, &v[i]);
}
if (len > 1) {
- v.pop_front();
+ v.remove_prefix(1);
EXPECT_EQ(len - 2, v.size());
for (size_t i = 0; i < v.size(); ++i) {
EXPECT_EQ(ptr + i + 1, &v[i]);
@@ -605,7 +605,6 @@ TEST(MutableIntSlice, IteratorsAndReferences) {
MutableIntSlice s = a;
accept_pointer(s.data());
- accept_pointer(s.mutable_data());
accept_iterator(s.begin());
accept_iterator(s.end());
accept_reverse_iterator(s.rbegin());
@@ -627,7 +626,6 @@ TEST(MutableIntSlice, IteratorsAndReferences_Const) {
const MutableIntSlice s = a;
accept_pointer(s.data());
- accept_pointer(s.mutable_data());
accept_iterator(s.begin());
accept_iterator(s.end());
accept_reverse_iterator(s.rbegin());