represents an array in a net that is shared by more than one layer.
- All instances of NetSharedArray["name"] in a net are treated as the same underlying array by NetInitialize, NetTrain, etc.
- The value of a shared array can be extracted with NetExtract[net,NetSharedArray["name"]].
- The value of a shared array can be updated with NetReplacePart[net,NetSharedArray["name"]->value].
- Any ordinary array of a layer such as LinearLayer, ConvolutionLayer, etc. can be specified to be a shared array.
- When one or more nets are combined into a larger net, the shared arrays of the larger net will be the union of the shared arrays of the original nets.
- A list of the values of all shared arrays in a net can be retrieved with NetExtract[net,NetSharedArray[All]].
- NetInsertSharedArrays[layer] will return a new layer in which all its arrays have been replaced with shared arrays.
Examplesopen allclose all
Basic Examples (4)
Use the LSTM layer on two separate inputs in a graph and combine the resulting states with a CatenateLayer:
Introduced in 2018
|Updated in 2019