represents an array in a net.


uses "name" as an identifier to share the array in more than one layer.


specifies the property prop for the array.


specifies several properties for the array.


  • NetArray is typically used to share arrays in NetChain/NetGraph or to define learnable parameters in FunctionLayer[].
  • All net arrays sharing the same name in a net are treated as the same underlying array by NetInitialize, NetTrain, etc.
  • The properties that can be specified are:
  • "Array"initial values or inialization method for the array
    "Dimensions"dimensions of the array
    "Name"name of the array, so that it can be shared
  • NetArray[] automatically gives a name (UUID) to the array and is equivalent to NetArray[Automatic].
  • NetInsertSharedArrays[layer] will return a new layer in which all its arrays have been replaced with named net arrays.


Basic Examples  (3)

Create a layer containing a shared array:

Create a chain that contains a shared array, used in two layers:

Initialize all arrays:

The weights from the two linear layers are the same (and will remain the same when training with NetTrain):

Extract all the shared arrays of a net:

Define a FunctionLayer that adds a list of learnable values to a list, initialized with arbitrary values:

Evaluate the layer on an input list:

The original NetArray corresponds to a NetArrayLayer in the equivalent NetGraph:

Wolfram Research (2020), NetArray, Wolfram Language function,


Wolfram Research (2020), NetArray, Wolfram Language function,


Wolfram Language. 2020. "NetArray." Wolfram Language & System Documentation Center. Wolfram Research.


Wolfram Language. (2020). NetArray. Wolfram Language & System Documentation Center. Retrieved from


@misc{reference.wolfram_2024_netarray, author="Wolfram Research", title="{NetArray}", year="2020", howpublished="\url{}", note=[Accessed: 21-June-2024 ]}


@online{reference.wolfram_2024_netarray, organization={Wolfram Research}, title={NetArray}, year={2020}, url={}, note=[Accessed: 21-June-2024 ]}