Fix engine check for case where grad is a subclass (#65568)

Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/65568

Test Plan: Imported from OSS

Reviewed By: soulitzer

Differential Revision: D31158089

Pulled By: albanD

fbshipit-source-id: 2a77df9b6340107de02a043b57a36cb7ae68df34
This commit is contained in:
Alban Desmaison
2021-09-24 08:37:41 -07:00
committed by Facebook GitHub Bot
parent e742839f0e
commit b858993c97
2 changed files with 2 additions and 2 deletions

View File

@ -490,7 +490,7 @@ $6 = torch._ops.aten.add_($1, $5)''')
return rs
x = NonWrapperSublass(torch.tensor([3.0, 4.0], requires_grad=True))
y = torch.randn(2)
y = torch.randn(2, requires_grad=True)
z = x * y
self.assertIsInstance(z, NonWrapperSublass)
z.sum().backward(torch.tensor(1))