(self)
| 2191 | self.assertEqual(gm(input), torch.relu(torch.neg(input))) |
| 2192 | |
| 2193 | def test_update_args_api(self): |
| 2194 | graph : torch.fx.Graph = torch.fx.Graph() |
| 2195 | x : torch.fx.Node = graph.create_node('placeholder', 'x') |
| 2196 | y : torch.fx.Node = graph.create_node('placeholder', 'y') |
| 2197 | b : torch.fx.Node = graph.create_node('call_function', target=torch.relu, args=(x,)) |
| 2198 | output : torch.fx.Node = graph.output(b) |
| 2199 | |
| 2200 | orig_gm = torch.fx.GraphModule(torch.nn.Module(), graph) |
| 2201 | inp_x, inp_y = torch.randn(5, 3), torch.randn(3, 5) |
| 2202 | self.assertEqual(orig_gm(inp_x, inp_y), torch.relu(inp_x)) |
| 2203 | |
| 2204 | |
| 2205 | b.update_arg(0, y) |
| 2206 | new_gm = torch.fx.GraphModule(torch.nn.Module(), graph) |
| 2207 | self.assertEqual(new_gm(inp_x, inp_y), torch.relu(inp_y)) |
| 2208 | |
| 2209 | def test_update_kwargs_api(self): |
| 2210 | graph : torch.fx.Graph = torch.fx.Graph() |
nothing calls this directly
no test coverage detected