mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
Better error messages for impl_abstract_pystub (#120959)
Pull Request resolved: https://github.com/pytorch/pytorch/pull/120959 Approved by: https://github.com/drisspg
This commit is contained in:
@ -42,7 +42,7 @@ class TestCustomOperators(TestCase):
|
||||
def f(x):
|
||||
return torch.ops.custom.asin(x)
|
||||
|
||||
with self.assertRaisesRegex(RuntimeError, r'unsupported operator: .* \(you may need to `import nonexistent`'):
|
||||
with self.assertRaisesRegex(RuntimeError, r'unsupported operator: .* you may need to `import nonexistent`'):
|
||||
f(x)
|
||||
|
||||
def test_abstract_impl_pystub_faketensor(self):
|
||||
@ -64,7 +64,7 @@ def forward(self, arg0_1):
|
||||
def test_abstract_impl_pystub_meta(self):
|
||||
x = torch.randn(3, device="meta")
|
||||
self.assertNotIn("my_custom_ops2", sys.modules.keys())
|
||||
with self.assertRaisesRegex(NotImplementedError, r"import the 'my_custom_ops2'"):
|
||||
with self.assertRaisesRegex(NotImplementedError, r"'my_custom_ops2'"):
|
||||
y = torch.ops.custom.sin.default(x)
|
||||
torch.ops.import_module("my_custom_ops2")
|
||||
y = torch.ops.custom.sin.default(x)
|
||||
|
Reference in New Issue
Block a user