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

@ -229,7 +229,7 @@ class TestBasics(TestCase):
for sample in _generate_sample_data(device=device):
data = sample.input
mask = sample.kwargs["mask"]
mt = masked_tensor(data.clone().detach(), mask, requires_grad=True)
mt = masked_tensor(data.detach().clone(), mask, requires_grad=True)
sparse_mt = mt.to_sparse()
data.to_sparse().to_dense().sum().backward()