Replace clone.detach with detach.clone (#140264)

Fixes #64532

As state in issue, replace `clone.detach` by `detach.clone`

Pull Request resolved: https://github.com/pytorch/pytorch/pull/140264
Approved by: https://github.com/soulitzer
This commit is contained in:
zeshengzong
2024-11-13 07:01:00 +00:00
committed by PyTorch MergeBot
parent f06ee3e546
commit cb71bcc542
66 changed files with 263 additions and 263 deletions

View File

@ -191,8 +191,8 @@ def forward(self, a_1):
torch.set_grad_enabled(True)
return b + c.sin()
a1 = torch.randn(4, requires_grad=True)
a2 = a1.clone().detach().requires_grad_(True)
a_tmp = a1.clone().detach().requires_grad_(True)
a2 = a1.detach().clone().requires_grad_(True)
a_tmp = a1.detach().clone().requires_grad_(True)
fx_g = make_fx(f, pre_dispatch=True)(a_tmp)
out1 = f(a1)
out2 = fx_g(a2)