[TF:XLA] remove re-initializations of Literals
authorNick Desaulniers <ndesaulniers@google.com>
Thu, 17 May 2018 16:54:17 +0000 (09:54 -0700)
committerTensorFlower Gardener <gardener@tensorflow.org>
Thu, 17 May 2018 16:57:02 +0000 (09:57 -0700)
commit9bdb7ec52c0262756d2d322435626d36161b60ed
treeb673b616acd8e5cfc937e3d12dbba05349f85308
parent295587d1819b0c8029a3db231fa09046ab75844c
[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
tensorflow/compiler/xla/literal_util.cc
tensorflow/compiler/xla/literal_util.h
tensorflow/compiler/xla/literal_util_test.cc
tensorflow/compiler/xla/service/hlo_evaluator.cc
tensorflow/compiler/xla/service/hlo_evaluator.h
tensorflow/compiler/xla/service/hlo_evaluator_typed_visitor.h
tensorflow/compiler/xla/tests/reduce_window_test.cc
tensorflow/compiler/xla/tests/test_utils.cc
tensorflow/compiler/xla/tests/tuple_test.cc