[dynamo] Graph break when faking named tensors (#120779)

Fixes #120644
Pull Request resolved: https://github.com/pytorch/pytorch/pull/120779
Approved by: https://github.com/zou3519
This commit is contained in:
James Wu
2024-02-29 06:21:24 -08:00
committed by PyTorch MergeBot
parent 1104e0798c
commit a911eb74ae
54 changed files with 18 additions and 4 deletions

View File

@ -686,10 +686,12 @@ class TestNamedTensor(TestCase):
self.assertEqual(op(a, a).names, ('N', 'C'))
self.assertEqual(op(a, c).names, ('N', 'C'))
with self.assertRaisesRegex(RuntimeError, "do not match"):
# TODO: dynamo will throw a slightly different
# error message because it's adding fake tensors
# `must match the size of` portion is the dynamo error
with self.assertRaisesRegex(RuntimeError, "do not match|must match the size of"):
op(a, d)
with self.assertRaisesRegex(RuntimeError, "do not match"):
with self.assertRaisesRegex(RuntimeError, "do not match|must match the size of"):
op(a, b)
def test_wildcard(op):