MCPcopy Create free account
hub / github.com/pytorch/pytorch / transform

Method transform

test/test_fx.py:1017–1024  ·  view source on GitHub ↗
(traced)

Source from the content-addressed store, hash-verified

1015 traced.graph.lint()
1016
1017 def transform(traced):
1018 new_graph = torch.fx.Graph()
1019 val_map : Dict[Node, Node] = {}
1020 output_value = new_graph.graph_copy(traced.graph, val_map)
1021 relu_out = new_graph.create_node(
1022 op='call_method', target='neg', args=(output_value,), kwargs={})
1023 new_graph.output(relu_out)
1024 return GraphModule(traced, new_graph)
1025 transformed = transform(traced)
1026 transformed.graph.lint()
1027 copied = copy.deepcopy(transformed)

Calls 4

graph_copyMethod · 0.95
create_nodeMethod · 0.95
outputMethod · 0.95
GraphModuleClass · 0.90

Tested by

no test coverage detected