WLJS LogoWLJS Notebook

NetSharedArray

NetSharedArray["name"] represents an array in a net that is shared by more than one layer.

Examples

Create a network with a shared array:

net = NetGraph[
  {LinearLayer[], LinearLayer[]},
  {1 -> 2},
  "Weights" -> NetSharedArray["sharedWeights"]
]

Access shared arrays in a network:

NetExtract[trainedNet, "sharedWeights"]

Initialize shared arrays:

NetInitialize[net, All, "Weights" -> NetSharedArray["w"]]

Please visit the official Wolfram Language Reference for more details.

On this page