r2.13 cherry-pick: 9f243084ecd "Rollback of PR #60432 Rollback of PR #60432 because of performance regressions."
Refer to the original commit: https://github.com/tensorflow/tensorflow/commit/9f243084ecd727d45c9b31a722efd35412a789d9