aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/compiler/xla/service/hlo_constant_folding.cc
diff options
context:
space:
mode:
authorGravatar Dimitris Vardoulakis <dimvar@google.com>2018-04-09 13:42:35 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-04-09 13:44:33 -0700
commit07e28a70874eef87772549c505d241eea2e6b9e9 (patch)
tree89fdef7840046678bf3c13de34538c6869e5be2e /tensorflow/compiler/xla/service/hlo_constant_folding.cc
parent36882e882c3de9be4381c266af6049b08fe2326c (diff)
Add opcode for new instruction that broadcasts degenerate dimensions.
Implicit broadcasts can be translated to the new instruction instead of a reshape-and-broadcast. Follow-up CLs will add support in UserComputation and the various backends. PiperOrigin-RevId: 192180356
Diffstat (limited to 'tensorflow/compiler/xla/service/hlo_constant_folding.cc')
-rw-r--r--tensorflow/compiler/xla/service/hlo_constant_folding.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/tensorflow/compiler/xla/service/hlo_constant_folding.cc b/tensorflow/compiler/xla/service/hlo_constant_folding.cc
index 35ecd4428d..7aa38c6b79 100644
--- a/tensorflow/compiler/xla/service/hlo_constant_folding.cc
+++ b/tensorflow/compiler/xla/service/hlo_constant_folding.cc
@@ -69,7 +69,8 @@ StatusOr<bool> HloConstantFolding::Run(HloModule* module) {
// Broadcasts dramatically increase the size of constants, which is often
// detrimental to performance and memory capacity, so do not fold
// broadcasts.
- if (instruction->opcode() == HloOpcode::kBroadcast) {
+ if (instruction->opcode() == HloOpcode::kBroadcast ||
+ instruction->opcode() == HloOpcode::kBroadcastDimOne) {
continue;
}