Getting internal outputs from SymbolBlock

I have symbol & params files trained by hybridized HybridBlock, then I load it using SymbolBlock. The question is how to get the internal outputs instead of the last outputs after a forward propagation?

Any help would be appreciated!

Finally got the answer, assume only have 1 input:

sym = mx.sym.load(symbol file)
# Choose the internal output you want
print(sym.get_internals().list_outputs())
new_sym = sym.get_internals()['xxx_output']
net = mx.gluon.nn.SymbolBlock(outputs=new_sym, inputs=[mx.sym.var('data0')])
net.collect_params().load(params file, ignore_extra=True)
pred = net(x)
print(pred)
1 Like