only use the latest version variable for inplace strategy (#16736)

* bug-fix, test=develop

* tweak code, test=develop
revert-16734-refine/test_imperative_transformer
liuwei1031 6 years ago committed by GitHub
parent 2146293d26
commit a18ef10c87
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -305,6 +305,12 @@ void InplacePass::TryInplaceOpInputOutput(ir::Node* op,
VLOG(4) << "Try to inplace " << in_var_name << " with " << out_var_name;
if (var_nodes_[in_var_name].back() != in_node) {
VLOG(4) << "SKIP since " << in_var_name
<< " is also used as output by other ops";
continue;
}
bool can_replace = true;
if (in_var_name == out_var_name) {
can_replace = false;

Loading…
Cancel
Save