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: D28412495
Pulled By: albanD
fbshipit-source-id: 97dd4580baac903805ab66ad55fe9570dec993ee