NetExtract
NetExtract[layer,"param"]
extracts the value of a parameter for the specified net layer.
NetExtract[net,lspec]
extracts the layer identified by lspec from within the NetGraph or NetChain object net.
NetExtract[net,{lspec,"param"}]
extracts the value of the parameter param from the layer identified by lspec in net.
NetExtract[net,{spec1,spec2,…}]
extracts a set of elements, where each speci is a list.
Details
- NetExtract supports the layer specification All to indicate that an association or list should be returned, giving all the layers within a NetGraph or NetChain.
- The layer specification can be an integer indicating the n
layer or a string indicating a named layer. - Parameter specifications can be the names of any of the arrays or options contained within a layer.
- NetExtract returns Automatic if a learned parameter has not yet been initialized, or an unlearned parameter has not yet been inferred.
- NetExtract[net,spec] is equivalent to net[[spec]] when spec is not a list of lists.
- For NetChain and NetGraph objects, Normal[net] is equivalent to NetExtract[net,All].
Examples
open allclose allBasic Examples (3)
Create a randomly initialized layer:
Extract the weight matrix from the layer:
Create a NetChain:
Scope (5)
Possible Issues (1)
See Also
Related Guides
Introduced in 2016
(11.0)