PR #13253: Make correct fusion decision for inplace fusion
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this [failed invocation](https://github.com/tensorflow/tensorflow/pull/69107/checks?check_run_id=25769099220) of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.
PR #13253: Make correct fusion decision for inplace fusion

Imported from GitHub PR https://github.com/openxla/xla/pull/13253

There exist bug when making fusion decision for inplace fusion. Current implementation does not consider non-elementwise ops in consumer and will lead to inplace conflict in some specific case. Detailed information can be seen in the added test.
Copybara import of the project:

--
fdde9d42774f5185ef0f38eb4b6972316953b1dc by Zhou, Lingzhi <lingzhi.zhou@intel.com>:

make correct fusion decision for inplace fusion

--
d2e7f3565c8476f77c74004c6aceb1a29eb951fc by Zhou, Lingzhi <lingzhi.zhou@intel.com>:

comment

Merging this change closes #13253

FUTURE_COPYBARA_INTEGRATE_REVIEW=https://github.com/openxla/xla/pull/13253 from lingzhi98:lingzhi/fix_inplace_fusion d2e7f3565c8476f77c74004c6aceb1a29eb951fc
