net = NetGraph[{3, 5, 8}, {1 -> 2 -> 3}, "Input" -> 2]
Take[net, {1, 2}]
But net[[1 ;; 2]]
gives Missing["NotPresent", {1 ;; 2}]
.
I find net//Normal
is:
But {a, b, c}[[1 ;; 2]] == Take[{a, b, c}, {1, 2}]
returns True
.
And There is a more complicated net:
net = NetGraph[{EmbeddingLayer[32, "Input" -> NetEncoder[{"Class", Range[0, 500]}]],
CatenateLayer[],64, Ramp, 43},
{NetPort["EmbeddingLayerInput"] -> 1 -> 2,
NetPort["Input2"] -> 2, 2 -> 3 -> 4 -> 5},
"Input2" -> 12]
I want to extract the sub-net like this:
NetGraph[{CatenateLayer[], 64, Ramp, 43},
{NetPort["Input"] -> 1,
NetPort["Input2"] -> 1 -> 2 -> 3 -> 4},
"Input2" -> 12, "Input" -> 32]
The way I can figure out is use this:
NetGraph[{CatenateLayer[], Take[net, {3, NetPort@"Output"}]},
{NetPort["Input"] -> 1, NetPort["Input2"] -> 1 -> 2},
"Input2" -> 12, "Input" -> 32]
So how to extract of sub-net of NetGraph
correctly?