mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-21 05:34:18 +08:00
Make interpolate_bilinear deterministic using decomposition (#101115)
Signed-off-by: Edward Z. Yang <ezyang@meta.com> Pull Request resolved: https://github.com/pytorch/pytorch/pull/101115 Approved by: https://github.com/ngimel
This commit is contained in:
committed by
PyTorch MergeBot
parent
daed3bf8f9
commit
c567748e16
@ -1439,6 +1439,24 @@ else:
|
||||
'upsample_bilinear2d_backward_out_cuda',
|
||||
torch.device(device).type == 'cuda')
|
||||
|
||||
@skipIfTorchInductor("aot-autograd issue")
|
||||
def test_deterministic_interpolate_bilinear(self, device):
|
||||
input = torch.randn(1, 2, 4, 4, device=device, requires_grad=True)
|
||||
grad = None
|
||||
with DeterministicGuard(True):
|
||||
for _ in range(5):
|
||||
res = torch.nn.functional.interpolate(
|
||||
input,
|
||||
size=12,
|
||||
mode='bilinear',
|
||||
align_corners=False)
|
||||
res.backward(torch.ones_like(res))
|
||||
if grad is None:
|
||||
grad = input.grad
|
||||
else:
|
||||
self.assertEqual(grad, input.grad, atol=0, rtol=0)
|
||||
input.grad = None
|
||||
|
||||
@skipIfMps
|
||||
@skipIfTorchInductor("aot-autograd issue")
|
||||
def test_nondeterministic_alert_interpolate_bicubic(self, device):
|
||||
|
Reference in New Issue
Block a user