Revert "Revert D28387764: Codegen inplace forward AD formula from out of place one if needed" (#58231)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/58231
This reverts commit 066e7699eb8c375a441e6de168da3ba7a73c3f27.
Test Plan: Imported from OSS
Reviewed By: ejguan
Differential Revision: D28412480
Pulled By: albanD
fbshipit-source-id: 7a231aa81b9e89537e6dca19642c4f12cd4b5ea5