diff options
author | 2017-06-14 11:06:36 -0700 | |
---|---|---|
committer | 2017-06-14 11:10:10 -0700 | |
commit | e3bb6eb846461ea2e3253b0b8774b6211357ee7a (patch) | |
tree | bdb8a65f17fac4a7b51ca61fbb6ce19c5a93fc5e /tensorflow/compiler/xla/service/hlo_constant_folding.cc | |
parent | 7520c401686e9139873b055019e3d18c6dc23b27 (diff) |
[XLA] Support broadcasting in the HloEvaluator.
PiperOrigin-RevId: 158997226
Diffstat (limited to 'tensorflow/compiler/xla/service/hlo_constant_folding.cc')
-rw-r--r-- | tensorflow/compiler/xla/service/hlo_constant_folding.cc | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/tensorflow/compiler/xla/service/hlo_constant_folding.cc b/tensorflow/compiler/xla/service/hlo_constant_folding.cc index 93f448e701..804efdd906 100644 --- a/tensorflow/compiler/xla/service/hlo_constant_folding.cc +++ b/tensorflow/compiler/xla/service/hlo_constant_folding.cc @@ -58,6 +58,13 @@ StatusOr<bool> HloConstantFolding::Run(HloModule* module) { continue; } + // Broadcasts dramatically increase the size of constants with is often + // detrimental to performance and memory capacity so do not fold + // broadcasts. + if (instruction->opcode() == HloOpcode::kBroadcast) { + continue; + } + std::unique_ptr<Literal> result = evaluator->TryEvaluate(instruction); // Currently we skip unimplemented operations. // TODO(b/35975797): Fold constant computations for more operations. |