I have a .json and a .params file of a pre-trained model which I want to use.
For demonstration let’s assume the network consists of named-layers and looks like this:
A → B → C → D → E
My goal is to split the network in two parts.
The first part should be A → B → C and the second part should be C → D → E.
This means, that the output of the first part is C after activation functions of B → C are applied.
The input for the second part is the direct output of layer C but before weights of C → D and activation functions are applied.
It works to get the first part, as I can specify C as the ouput layer of the network.
But I can not achieve to create the second part of the network, as creating the symbol
E = sym.get_internals()[‘E’]
second_network = mx.gluon.nn.SymbolBlock(outputs=E, inputs=[mx.sym.var(‘C’)])
does not work. It throws an error that the input needs to be bound to data, I can not set C to the input.
Any help getting this to work is appreciated.
Please note, that simply setting the output of the network to [C, E] is not sufficient. I need to get C first and then put it into the second network.
Thank you very much.