aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/compiler/xla/tests/test_utils.cc
diff options
context:
space:
mode:
authorGravatar Kay Zhu <kayzhu@google.com>2018-07-03 19:01:49 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-07-03 19:06:26 -0700
commit8779f768a3c0fa8d48c25f71d65513c208c77432 (patch)
treee11ec13b24f7b599449f90d234b9fdc5c6a46180 /tensorflow/compiler/xla/tests/test_utils.cc
parent1e7dde8791c535bd09bda9f9ecbe8594aed4f4c6 (diff)
[TF:XLA] Split literal_util into {literal, literal_util}.
Currently Literal classes sits in literal_util.{h,cc} instead of literal.{h,cc}. It also contains helper functions that are better fit to be their own separate class/namespace. This change starts this process by moving most static factory methods to LiteralUtil namespace. PiperOrigin-RevId: 203217065
Diffstat (limited to 'tensorflow/compiler/xla/tests/test_utils.cc')
-rw-r--r--tensorflow/compiler/xla/tests/test_utils.cc9
1 files changed, 5 insertions, 4 deletions
diff --git a/tensorflow/compiler/xla/tests/test_utils.cc b/tensorflow/compiler/xla/tests/test_utils.cc
index 20c7c30878..2647937013 100644
--- a/tensorflow/compiler/xla/tests/test_utils.cc
+++ b/tensorflow/compiler/xla/tests/test_utils.cc
@@ -14,6 +14,7 @@ limitations under the License.
==============================================================================*/
#include "tensorflow/compiler/xla/tests/test_utils.h"
+#include "tensorflow/compiler/xla/literal_util.h"
#include "tensorflow/compiler/xla/primitive_util.h"
#include "tensorflow/compiler/xla/service/hlo_dataflow_analysis.h"
#include "tensorflow/compiler/xla/service/hlo_verifier.h"
@@ -110,7 +111,7 @@ StatusOr<std::unique_ptr<Literal>> MakeFakeLiteralInternal(
MakeFakeLiteralInternal(element_shape, engine));
elements.push_back(std::move(element));
}
- return Literal::MakeTupleOwned(std::move(elements));
+ return LiteralUtil::MakeTupleOwned(std::move(elements));
}
if (engine == nullptr) {
return Literal::CreateFromShape(shape);
@@ -220,7 +221,7 @@ std::unique_ptr<Literal> MakeRandomNonwrappingSliceIndex(
start_indices[i] = generator(*engine);
}
}
- return Literal::CreateR1<int32>(start_indices);
+ return LiteralUtil::CreateR1<int32>(start_indices);
}
// Use dataflow analysis on each parameter to see if there are uses that would
@@ -318,9 +319,9 @@ StatusOr<std::unique_ptr<Literal>> CreateLiteralForConstrainedUses(
} else if (needs_constant != nullptr) {
switch (constant_type) {
case ConstantType::kZero:
- return Literal::Zero(param.shape().element_type()).CloneToUnique();
+ return LiteralUtil::Zero(param.shape().element_type()).CloneToUnique();
case ConstantType::kOne:
- return Literal::One(param.shape().element_type()).CloneToUnique();
+ return LiteralUtil::One(param.shape().element_type()).CloneToUnique();
case ConstantType::kUnknown:
// We want the identity element for the computation, but we don't really
// know what it is - so any value we generate will be just as wrong.