graph_def_editor
graph_def_editor copied to clipboard
is the following operation possible
I have a tensorflow saved model pb.
I would like to replace part of that pb (a subgraph) with a custom operator.
Is something like this feasible using this framework? If not currently I am willing to help contribute if in general this an be achieved.
Yes, it is definitely possible, in fact it is one of the main use cases for graph editor.
Also I realized that there are no good examples how to do this. Probably this is the best one: https://github.com/CODAIT/graph_def_editor/blob/f3e0c8553067a3119a245ce4b8dbcc487c2fe2b2/graph_def_editor/rewrite.py#L377
The process is following:
- Create a new node using: n = g.add_node(...)
- Set inputs and attributes for the new node: n.set_inputs(...)
- Replace output of an existing subgraph by an output from your node: reroute.reroute_ts(...)
- Optionally remove old subgraph