Commit 7ebf7157 authored by Chris Sullivan's avatar Chris Sullivan Committed by Robert Kimball

Don't reuse memory for non-destructive ops (#1679)

* Don't reuse memory for non-destructive ops.

* Update comment.
parent 8d55382c
......@@ -51,12 +51,9 @@ bool pass::MemoryLayout::run_on_function(shared_ptr<ngraph::Function> function)
auto input = &node->get_inputs().at(oi_pair.input).get_tensor();
auto input_node = node->get_inputs().at(oi_pair.input).get_output().get_node();
// an input tensor can be reused if this is the last use or
// an op isn't destructive (i.e. Reshape(DimShuffle))
if ((node->liveness_free_list.count(input) != 0 &&
node->liveness_new_list.count(output) != 0) ||
(!oi_pair.destructive && !input_node->is_parameter() &&
!input_node->is_constant()))
// an input tensor can be reused if this is the last use
if (node->liveness_free_list.count(input) != 0 &&
node->liveness_new_list.count(output) != 0)
{
in_place_outputs.insert({output, input});
reused_inputs.insert(input);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment