mirror of
https://github.com/pytorch/pytorch.git
synced 2026-11-20 09:04:25 +08:00
Add new tls snapshot feature (#72623)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/72623
Test Plan: Imported from OSS
Reviewed By: samdow
Differential Revision: D34214953
Pulled By: albanD
fbshipit-source-id: 7aa5d5e3540a45a0ae70c5af3a4495c755908aa9
(cherry picked from commit dc0a1ab54a)
This commit is contained in:
committed by
PyTorch MergeBot
parent
454e2ec7bc
commit
6199b5231f
@@ -551,21 +551,16 @@ $6 = torch._ops.aten.add_($1, $5)''')
|
||||
self.assertFalse(out.requires_grad)
|
||||
self.assertIsNone(out.grad_fn)
|
||||
|
||||
# TODO: this should be True
|
||||
self.assertFalse(out.elem.requires_grad)
|
||||
# TODO: this should be not None
|
||||
self.assertIsNone(out.elem.grad_fn)
|
||||
self.assertTrue(out.elem.requires_grad)
|
||||
self.assertIsNotNone(out.elem.grad_fn)
|
||||
|
||||
with self.assertRaisesRegex(RuntimeError, "does not require grad"):
|
||||
out.backward()
|
||||
out.sum().backward()
|
||||
|
||||
# TODO: this should not raise
|
||||
with self.assertRaisesRegex(RuntimeError, "does not require grad"):
|
||||
out.elem.backward()
|
||||
out.elem.sum().backward()
|
||||
|
||||
self.assertIsNone(t.grad)
|
||||
# TODO: this should not be None
|
||||
self.assertIsNone(t.elem.grad)
|
||||
self.assertIsNotNone(t.elem.grad)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
Reference in New Issue
Block a user