diff options
author | 2018-08-30 16:03:10 -0700 | |
---|---|---|
committer | 2018-08-30 16:07:27 -0700 | |
commit | 6f879f891abe2e267c5cf512d034d7c3641cfdb0 (patch) | |
tree | 33dfda2aa13bdec06d3aa330dd5816441d449fa7 /tensorflow/compiler/tests | |
parent | 5d5591fbd4624ff7e50f305464667315f2d41ebb (diff) |
[XLA] Rename all (Mutable)ArraySlice to absl::Span.
PiperOrigin-RevId: 210998142
Diffstat (limited to 'tensorflow/compiler/tests')
-rw-r--r-- | tensorflow/compiler/tests/randomized_tests.cc | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/tensorflow/compiler/tests/randomized_tests.cc b/tensorflow/compiler/tests/randomized_tests.cc index 1b8198dba8..0faf0fd8ed 100644 --- a/tensorflow/compiler/tests/randomized_tests.cc +++ b/tensorflow/compiler/tests/randomized_tests.cc @@ -275,13 +275,13 @@ class OpTest : public ::testing::Test { // Select a random element from 'candidates'. template <typename T> - T Choose(gtl::ArraySlice<T> candidates); + T Choose(absl::Span<const T> candidates); static constexpr int kDefaultMaxRank = 5; static constexpr int64 kDefaultMaxDimensionSize = 256LL; // Returns true if 'dims' have a size less than tf_xla_max_tensor_size. - bool TensorSizeIsOk(gtl::ArraySlice<int64> dims); + bool TensorSizeIsOk(absl::Span<const int64> dims); // Returns a random dimension size, in the range [min, max). int64 RandomDim(int64 min = 0, int64 max = kDefaultMaxDimensionSize); @@ -307,11 +307,11 @@ class OpTest : public ::testing::Test { // of the type's range. If the shape is omitted, a random shape is used. // TODO(phawkins): generalize this code to a caller-supplied distribution. Tensor RandomTensor(DataType dtype, bool needs_unique_values, - gtl::ArraySlice<int64> shape); + absl::Span<const int64> shape); Tensor RandomTensor(DataType dtype); // Like RandomTensor, but uses values >= 0. - Tensor RandomNonNegativeTensor(DataType dtype, gtl::ArraySlice<int64> shape); + Tensor RandomNonNegativeTensor(DataType dtype, absl::Span<const int64> shape); Tensor RandomNonNegativeTensor(DataType dtype); // Returns a random subset of the integers in the range [0, rank), suitable @@ -415,7 +415,7 @@ void OpTest::Repeatedly(const std::function<TestResult(void)>& fn) { } template <typename T> -T OpTest::Choose(gtl::ArraySlice<T> candidates) { +T OpTest::Choose(absl::Span<const T> candidates) { std::uniform_int_distribution<size_t> d(0, candidates.size() - 1); return candidates[d(generator())]; } @@ -425,7 +425,7 @@ int64 OpTest::RandomDim(int64 min, int64 max) { return size_distribution(generator()); } -bool OpTest::TensorSizeIsOk(gtl::ArraySlice<int64> dims) { +bool OpTest::TensorSizeIsOk(absl::Span<const int64> dims) { int64 size = 1LL; for (int64 dim : dims) { size *= dim; @@ -451,7 +451,7 @@ std::vector<int64> OpTest::RandomDims(int min_rank, int max_rank, } Tensor OpTest::RandomTensor(DataType dtype, bool needs_unique_values, - gtl::ArraySlice<int64> shape) { + absl::Span<const int64> shape) { Tensor tensor(dtype, TensorShape(shape)); switch (dtype) { case DT_FLOAT: { @@ -548,7 +548,7 @@ Tensor OpTest::RandomTensor(DataType dtype) { } Tensor OpTest::RandomNonNegativeTensor(DataType dtype, - gtl::ArraySlice<int64> shape) { + absl::Span<const int64> shape) { Tensor tensor(dtype, TensorShape(shape)); switch (dtype) { case DT_FLOAT: { @@ -1884,7 +1884,7 @@ TEST_F(OpTest, DynamicStitch) { for (int i = 0; i < n; ++i) { TensorShape shape(index_dims[i]); Tensor t = test::AsTensor<int32>( - gtl::ArraySlice<int32>(indices).subspan(pos, shape.num_elements()), + absl::Span<const int32>(indices).subspan(pos, shape.num_elements()), shape); builder.Input(t); pos += t.NumElements(); |