aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/compiler/xla/service/algebraic_simplifier.cc
diff options
context:
space:
mode:
authorGravatar Kay Zhu <kayzhu@google.com>2018-05-09 13:07:35 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-05-09 13:47:51 -0700
commite1347ba769b98e260d36e895be2963af35c88d18 (patch)
tree3f8c5d4edaa71035459f08d9520a4a0fdbcaadf5 /tensorflow/compiler/xla/service/algebraic_simplifier.cc
parenta4afe20fb4663c0f3b7f1b0086fe1c97557fea7b (diff)
[XLA] First step in adding Literal slice classes, to improve interface safety
and prepare for enabling more efficient interfacing from Tensor to Literal to reduce host to device latency. More specically: * Introducing a new LiteralBase abstract base class that contains all immutable methods of from the old Literal class. * Introducing a subclass LiteralSlice to replace original LiteralView class. LiteralSlice class is read-only and does not own Shape nor any buffer through the Pieces. Change a number of callers to use LiteralSlice directly. * Change Literal class to explicitly own the underlying Shape as well as owning the underlying buffer via Piece. * Conversion from Literal to LiteralSlice is now done via an implicit conversion constructor instead of inheritance. * Decouple ShapeTree from Literal classes. * Use copy-and-swap for assignment constructors. * Other minor cleanups. PiperOrigin-RevId: 196016576
Diffstat (limited to 'tensorflow/compiler/xla/service/algebraic_simplifier.cc')
-rw-r--r--tensorflow/compiler/xla/service/algebraic_simplifier.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/tensorflow/compiler/xla/service/algebraic_simplifier.cc b/tensorflow/compiler/xla/service/algebraic_simplifier.cc
index 4ec79a0244..3ce80bba17 100644
--- a/tensorflow/compiler/xla/service/algebraic_simplifier.cc
+++ b/tensorflow/compiler/xla/service/algebraic_simplifier.cc
@@ -501,13 +501,13 @@ Status AlgebraicSimplifierVisitor::HandleConcatenate(
}
static HloInstruction* BuildTupleConstant(HloComputation* computation,
- const Literal& literal) {
+ const LiteralSlice& literal) {
if (ShapeUtil::IsTuple(literal.shape())) {
std::vector<HloInstruction*> elems;
elems.reserve(ShapeUtil::TupleElementCount(literal.shape()));
for (int i = 0; i < ShapeUtil::TupleElementCount(literal.shape()); ++i) {
elems.push_back(
- BuildTupleConstant(computation, LiteralView::Create(literal, {i})));
+ BuildTupleConstant(computation, LiteralSlice(literal, {i})));
}
return computation->AddInstruction(HloInstruction::CreateTuple(elems));
} else {