Minor cleanups to the gather expander; NFC
authorSanjoy Das <sanjoy@google.com>
Wed, 18 Apr 2018 00:17:04 +0000 (17:17 -0700)
committerTensorFlower Gardener <gardener@tensorflow.org>
Wed, 18 Apr 2018 00:19:19 +0000 (17:19 -0700)
commitab16333f04df819fff34714b748010149443106d
tree7ce3e73f3e086eadcd1cf11f07236249e0f37938
parent9a6e21726e9978b9ab5442ad63dbc8037ec4a941
Minor cleanups to the gather expander; NFC

This change is NFC now, but it makes the code more general and this generality
will be used later on.  For instance

  ExpandFirstDimIntoNDims(transposed_gather_indices, {1, shape.dimensions(0)})

does not work if shape is a scalar shape (and this fine because today shape is
never scalar) but

  PrependDegenerateDims(transposed_gather_indices, 1)

works fine if transposed_gather_indices is scalar (and it will be, in a future
change).

PiperOrigin-RevId: 193283404
tensorflow/compiler/xla/service/BUILD
tensorflow/compiler/xla/service/gather_expander.cc
tensorflow/compiler/xla/service/hlo_creation_utils.cc
tensorflow/compiler/xla/service/hlo_creation_utils.h
tensorflow/compiler/xla/service/hlo_creation_utils_test.cc [new file with mode: 0644]