mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 12:54:11 +08:00
Add some forward AD formulas (#69384)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/69384 Test Plan: Imported from OSS Reviewed By: albanD Differential Revision: D33020602 Pulled By: soulitzer fbshipit-source-id: a92dd243f2b5b21fe277b0bb17bcd61dfe5a0d67
This commit is contained in:
committed by
Facebook GitHub Bot
parent
baf92f9d5a
commit
0dcbd73eee
@ -516,6 +516,9 @@ class TestViewOps(TestCase):
|
||||
g_expected = torch.stack([gi if j == i else torch.zeros_like(gi)
|
||||
for j in range(3)], dim=0)
|
||||
self.assertEqual(g, g_expected)
|
||||
# Check with gradcheck
|
||||
stacked = torch.randn(3, 10, 10, dtype=torch.double, requires_grad=True)
|
||||
gradcheck(lambda x: x.unbind(), (stacked,), check_forward_ad=True)
|
||||
|
||||
def test_expand_view(self, device) -> None:
|
||||
t = torch.ones((5, 1), device=device)
|
||||
|
Reference in New Issue
Block a user