mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 12:54:11 +08:00
Add missing attr access check for legacy autograd.Function (#155055)
Fixes https://github.com/pytorch/pytorch/issues/154981 Pull Request resolved: https://github.com/pytorch/pytorch/pull/155055 Approved by: https://github.com/albanD ghstack dependencies: #154509, #154852
This commit is contained in:
committed by
PyTorch MergeBot
parent
5dd07c70e5
commit
1ed243f01c
@ -3725,6 +3725,18 @@ class TestAutograd(TestCase):
|
||||
f.next_functions
|
||||
with self.assertRaisesRegex(RuntimeError, "Attribute 'name' is invalid"):
|
||||
f.name()
|
||||
with self.assertRaisesRegex(
|
||||
RuntimeError, "Attribute '_sequence_nr' is invalid"
|
||||
):
|
||||
f._sequence_nr()
|
||||
with self.assertRaisesRegex(
|
||||
RuntimeError, "Attribute '_set_sequence_nr' is invalid"
|
||||
):
|
||||
f._set_sequence_nr(2)
|
||||
with self.assertRaisesRegex(
|
||||
RuntimeError, "Attribute '_input_metadata' is invalid"
|
||||
):
|
||||
f._input_metadata
|
||||
with self.assertRaisesRegex(
|
||||
RuntimeError, "underlying PyNode has already been deallocated"
|
||||
):
|
||||
|
Reference in New Issue
Block a user