[fx][split][testing] Add testing for #107981 (#108731)

- Follow-up to #107981, adding testing for metadata copying in placeholder nodes within the `split_by_tags` utility
- Validation included in the test from #107248, since both tests are relevant to the same aspect of the utility
Pull Request resolved: https://github.com/pytorch/pytorch/pull/108731
Approved by: https://github.com/angelayi
This commit is contained in:
gs-olive 2023-12-18 20:19:14 +00:00 committed by PyTorch MergeBot
parent bf20b56e9d
commit e30d436b01

View File

@ -34,6 +34,11 @@ class TestFXSplit(TestCase):
self.assertIn("name", n.meta) self.assertIn("name", n.meta)
self.assertEqual(n.meta["name"], n.name) self.assertEqual(n.meta["name"], n.name)
# Validate that metadata is copied correctly for graph placeholder nodes
for node in split_gm.graph.nodes:
if node.op == "placeholder":
self.assertIn("name", node.meta)
self.assertEqual(node.meta["name"], node.name)
class TestSplitByTags(TestCase): class TestSplitByTags(TestCase):
class TestModule(torch.nn.Module): class TestModule(torch.nn.Module):