I downloaded a trained model that is using nngraph.
I want to be able to cut the graph in two, to add my personal stuff in the middle.
Instead of
Z = model:forward( {X1, X2} )
I want to do
Y = modelA:forward( {X1, X2} )
Y = process(Y)
Z = modelB:forward( {Y} )
Is this possible, or is the only way to do it is to extracts nodes one by one to rebuild two models ?
And if I want to do it node by node, what is the proper way to do it ? There seem to be redundancy in the model data structure.
Should I do model.fg.nodes[1].data.module to access the content of each node and then rebuild the nngraph ?
As I am not used to Torch (and lua) I don't know what is the proper way to do it.
Also, how can I manually extract each tensor and save it in a format that can be loaded by Numpy ?
Thanks.