mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
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:
committed by
PyTorch MergeBot
parent
f06ee3e546
commit
cb71bcc542
@ -652,7 +652,7 @@ class TestModule(TestCase):
|
||||
d = obj.dim()
|
||||
if ((mem_format == torch.channels_last and d != 4)
|
||||
or (mem_format == torch.channels_last_3d and d != 5)):
|
||||
return obj.clone().detach().requires_grad_(obj.requires_grad)
|
||||
return obj.detach().clone().requires_grad_(obj.requires_grad)
|
||||
return obj.clone().to(memory_format=mem_format).detach().requires_grad_(obj.requires_grad)
|
||||
|
||||
return self._traverse_obj(obj, inner_to_mem_format)
|
||||
|
Reference in New Issue
Block a user