[XLA] Reshape mover should only transform a reshape/transpose instruction if
authorBixia Zheng <bixia@google.com>
Wed, 4 Apr 2018 01:08:21 +0000 (18:08 -0700)
committerTensorFlower Gardener <gardener@tensorflow.org>
Wed, 4 Apr 2018 01:11:02 +0000 (18:11 -0700)
commit2615b467def240e6a90f309aaa56311677104d63
tree5cb493b0d745e4a9feb38d1624e0f7b918405291
parent6d05c781d71b09f10246b2d15039e1b1df899f62
[XLA] Reshape mover should only transform a reshape/transpose instruction if
all the users of the instruction can be transformed.

This is because if only part of the users of a reshape/transpose instruction are
reshape-move transformed, the original reshape/transpose instruction can't be
eliminated while a modified clone copy of the instruction is added to support
the transformation. As a result, the transformation increases the number of
reshape/transpose instructions in the kerenel and can potentially increase
memory consumption.

Add two test cases.

PiperOrigin-RevId: 191529681
tensorflow/compiler/xla/service/reshape_mover.cc
tensorflow/compiler/xla/service/reshape_mover_test.cc