diff options
author | A. Unique TensorFlower <gardener@tensorflow.org> | 2018-07-05 03:59:16 -0700 |
---|---|---|
committer | TensorFlower Gardener <gardener@tensorflow.org> | 2018-07-05 04:01:55 -0700 |
commit | c0e54af2ab3786b63fba64608f907b0879bbf553 (patch) | |
tree | e6b4bfe6e243d8f6ac679f77323ff06d91c849c4 /tensorflow/compiler/xla/service/zero_sized_hlo_elimination.cc | |
parent | f3e8ac94b38e11d0552672ff5e9468a9f302154b (diff) |
Fix zero size hlo elimination to not replace empty constants
The pass tries to replace zero sized hlo's with constants of the same
shape what makes no sense if the replaced hlo is already a constant.
PiperOrigin-RevId: 203357381
Diffstat (limited to 'tensorflow/compiler/xla/service/zero_sized_hlo_elimination.cc')
-rw-r--r-- | tensorflow/compiler/xla/service/zero_sized_hlo_elimination.cc | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/tensorflow/compiler/xla/service/zero_sized_hlo_elimination.cc b/tensorflow/compiler/xla/service/zero_sized_hlo_elimination.cc index 0a3a757b27..83d696fe09 100644 --- a/tensorflow/compiler/xla/service/zero_sized_hlo_elimination.cc +++ b/tensorflow/compiler/xla/service/zero_sized_hlo_elimination.cc @@ -32,7 +32,8 @@ StatusOr<bool> ZeroSizedHloElimination::Run(HloModule* module) { for (HloComputation* comp : module->MakeNonfusionComputations()) { for (HloInstruction* instruction : comp->MakeInstructionPostOrder()) { if (instruction->HasSideEffect() || - !ShapeUtil::IsArray(instruction->shape())) { + !ShapeUtil::IsArray(instruction->shape()) || + instruction->opcode() == HloOpcode::kConstant) { continue; } if (comp->IsRemovable(instruction) && |