I’l looking to take a graph that looks like the below (left side) and turn it into the right side graph to make it fit on a device with small on device memory
I was wondering if there was a recommended way to do such transformations? My output graph is not a linkedlist of nodes as in a ->b → c so I don’t think the append and prepend operations will help my use case. Basically I want to be able to manually set the parent and children of a node, set some parameters for that node/layer and then add a new cat operation and generate a new graph.
Adding a new cat operations seems to be simple: pytorch/merge_matmul.py at master · pytorch/pytorch · GitHub
Returning a new graph also simple: pytorch/merge_matmul.py at master · pytorch/pytorch · GitHub
Set parameters: Should I manually just write to the modules dictionary?
Unsure how to set parent and children for nodes, have a node potentially have multiple children