[quant][graphmode] Add support for detach (#40197)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/40197
Test Plan: Imported from OSS
Differential Revision: D22106544
fbshipit-source-id: 047236bf8c7cb0813563e6c7bcd41b79dfa6fb2b