Test node that has users.
(self)
| 117 | """Tests for has_no_users function.""" |
| 118 | |
| 119 | def test_has_users(self): |
| 120 | """Test node that has users.""" |
| 121 | from executorch.backends.mlx.pattern_utils import has_no_users |
| 122 | |
| 123 | class SimpleModule(torch.nn.Module): |
| 124 | def forward(self, x): |
| 125 | y = torch.neg(x) |
| 126 | return y + 1 |
| 127 | |
| 128 | graph = get_exported_graph(SimpleModule(), (torch.randn(4, 4),)) |
| 129 | neg_node = find_node_by_target(graph, "neg") |
| 130 | |
| 131 | self.assertIsNotNone(neg_node) |
| 132 | self.assertFalse(has_no_users(neg_node)) |
| 133 | |
| 134 | def test_no_users_after_removal(self): |
| 135 | """Test has_no_users returns True for orphaned nodes.""" |
nothing calls this directly
no test coverage detected