aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/compiler/xla/tests/test_utils.cc
diff options
context:
space:
mode:
authorGravatar Nick Desaulniers <ndesaulniers@google.com>2018-05-17 09:54:17 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-05-17 09:57:02 -0700
commit9bdb7ec52c0262756d2d322435626d36161b60ed (patch)
treeb673b616acd8e5cfc937e3d12dbba05349f85308 /tensorflow/compiler/xla/tests/test_utils.cc
parent295587d1819b0c8029a3db231fa09046ab75844c (diff)
[TF:XLA] remove re-initializations of Literals
It's an antipattern to have: auto x = Literal::CreateFromShape(my_shape); x->Populate(); as that results in initialization followed by reinitialization. Can be replaced with: auto x = MakeUnique<Literal>(my_shape); x->Populate(); Suggested-by: Kay Zhu <kayzhu@google.com> PiperOrigin-RevId: 197007127
Diffstat (limited to 'tensorflow/compiler/xla/tests/test_utils.cc')
-rw-r--r--tensorflow/compiler/xla/tests/test_utils.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/tensorflow/compiler/xla/tests/test_utils.cc b/tensorflow/compiler/xla/tests/test_utils.cc
index 810cc25f1b..de18651388 100644
--- a/tensorflow/compiler/xla/tests/test_utils.cc
+++ b/tensorflow/compiler/xla/tests/test_utils.cc
@@ -107,7 +107,7 @@ StatusOr<std::unique_ptr<Literal>> MakeFakeLiteralInternal(
}
return Literal::MakeTupleOwned(std::move(elements));
}
- std::unique_ptr<Literal> literal = Literal::CreateFromShape(shape);
+ auto literal = MakeUnique<Literal>(shape);
switch (shape.element_type()) {
case BF16:
PopulateWithRandomFloatingPointData<bfloat16>(literal.get(), engine);