NetInsertSharedArrays

NetInsertSharedArrays[net]

converts all ordinary arrays in net into NetSharedArray objects.

NetInsertSharedArrays[net,"prefix"]

uses a prefix for the names of all newly shared arrays.

Details

  • Each array in the net will be shared using a name that is derived from its position within the net.
  • By sharing all arrays in a net, multiple instances of that net within a larger net will behave identically during training and evaluation.

Examples

open allclose all

Basic Examples  (3)

Convert arrays in a layer into shared arrays:

In[1]:=
Click for copyable input
Out[1]=

Convert arrays in a layer into shared arrays, using a specific prefix:

In[1]:=
Click for copyable input
Out[1]=

Convert arrays in layers within a net into shared arrays:

In[1]:=
Click for copyable input
Out[1]=

Properties & Relations  (1)

See Also

NetSharedArray  NetExtract  NetReplacePart  NetInitialize  NetTrain  NetInformation

Tutorials

Introduced in 2018
(11.3)