diff options
author | A. Unique TensorFlower <gardener@tensorflow.org> | 2018-06-14 07:51:36 -0700 |
---|---|---|
committer | TensorFlower Gardener <gardener@tensorflow.org> | 2018-06-14 07:54:22 -0700 |
commit | b704ab9e65a3e44568e91eeded277fdd1b072508 (patch) | |
tree | e6e4726f93c4a3a55c05bff4855b56724bddb7ae /tensorflow/compiler/xla/service/hlo_computation.cc | |
parent | a7c1b0347bda30c300ae55ad060b6cb965ded831 (diff) |
Make deleting HloInstruction safer.
PiperOrigin-RevId: 200555862
Diffstat (limited to 'tensorflow/compiler/xla/service/hlo_computation.cc')
-rw-r--r-- | tensorflow/compiler/xla/service/hlo_computation.cc | 10 |
1 files changed, 0 insertions, 10 deletions
diff --git a/tensorflow/compiler/xla/service/hlo_computation.cc b/tensorflow/compiler/xla/service/hlo_computation.cc index c73e54a0b1..ac7afac19f 100644 --- a/tensorflow/compiler/xla/service/hlo_computation.cc +++ b/tensorflow/compiler/xla/service/hlo_computation.cc @@ -234,7 +234,6 @@ Status HloComputation::RemoveInstruction(HloInstruction* instruction) { TF_RET_CHECK(instruction_iterators_.count(instruction) != 0); auto inst_it = instruction_iterators_.at(instruction); (*inst_it)->set_parent(nullptr); - instruction->DetachFromOperands(); instructions_.erase(inst_it); return Status::OK(); } @@ -868,15 +867,6 @@ std::unique_ptr<HloComputation> HloComputation::CloneWithReplacements( } } context->MapComputation(this, result.get()); - // We cloned the elements of 'replacements', so they're all going to be - // destroyed. HloInstructions need to be detached from their operands before - // they're destroyed, otherwise they stick around in the operands' users lists - // and cause use-after-frees. - for (auto& kv : replacements) { - if (std::unique_ptr<HloInstruction>& new_instr = kv.second) { - new_instr->DetachFromOperands(); - } - } return result; } |