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)
The weights from the two linear layers are the same (and will remain the same when training with NetTrain):
Define a FunctionLayer that adds a list of learnable values to a list, initialized with arbitrary values:
Wolfram Research (2020), NetArray, Wolfram Language function, https://reference.wolfram.com/language/ref/NetArray.html.
Wolfram Language. 2020. "NetArray." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/NetArray.html.
Wolfram Language. (2020). NetArray. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/NetArray.html