(self)
| 2160 | |
| 2161 | |
| 2162 | def test_replace_input(self): |
| 2163 | graph : torch.fx.Graph = torch.fx.Graph() |
| 2164 | x : torch.fx.Node = graph.create_node('placeholder', 'x') |
| 2165 | y : torch.fx.Node = graph.create_node('placeholder', 'y') |
| 2166 | b : torch.fx.Node = graph.create_node('call_function', target=torch.relu, args=(x,)) |
| 2167 | output : torch.fx.Node = graph.output(b) |
| 2168 | |
| 2169 | b.replace_input_with(x, y) |
| 2170 | |
| 2171 | gm = torch.fx.GraphModule(torch.nn.Module(), graph) |
| 2172 | |
| 2173 | input_x = torch.randn(33, 44) |
| 2174 | input_y = torch.randn(11, 22) |
| 2175 | self.assertEqual(gm(input_x, input_y), torch.relu(input_y)) |
| 2176 | |
| 2177 | def test_insertion_point(self): |
| 2178 | graph : torch.fx.Graph = torch.fx.Graph() |
nothing calls this directly
no test coverage detected