represents a layer that has no input and produces as output a constant array.
NetArrayLayer[opts]
includes options for the initial value of the array or output size.


NetArrayLayer
represents a layer that has no input and produces as output a constant array.
NetArrayLayer[opts]
includes options for the initial value of the array or output size.
Details and Options

- NetArrayLayer is typically used in a NetGraph and allows a learned array to be used as an ordinary input to other layers. Without NetArrayLayer, all layer inputs must ultimately be derived from inputs to the entire net.
- The array stored by NetArrayLayer will be learned during training.
- The constant array stored in NetArrayLayer has the same dimensions as the output of NetArrayLayer.
- NetArrayLayer["Array"->array] can be used to give an explicit value of the constant array.
- When the constant array is not explicitly specified or is given as Automatic, it is added automatically when NetInitialize or NetTrain is used.
- NetArrayLayer["Output"->{d1,d2,…}] can be used to fix the output size of the layer, which also fixes the size of the constant array.
- The following training parameter can also be included:
-
LearningRateMultipliers Automatic learning rate multipliers for the array - NetArrayLayer[…][] returns the constant array.
- The constant array can also be obtained from an initialized NetArrayLayer using NetExtract[layer,"Array"].
- Options[NetArrayLayer] gives the list of default options to construct the layer. Options[NetArrayLayer[…]] gives the list of default options to evaluate the layer on some data.
- Information[NetArrayLayer[…]] gives a report about the layer.
- Information[NetArrayLayer[…],prop] gives the value of the property prop of NetArrayLayer[…]. Possible properties are the same as for NetGraph.
Examples
open all close allBasic Examples (2)
Create a NetArrayLayer:
Create an initialized NetArrayLayer with output dimensions specified:
Scope (7)
Arguments (4)
Create a NetArrayLayer with unspecified output size:
Create a NetArrayLayer with output dimensions specified:
Parameters (2)
"Array" (2)
Create a NetArrayLayer with a specific initial value for the array:
Use the array in an elementwise operation in a NetGraph:
Create a NetArrayLayer with fixed output array that is not changing during the training:
Possible Issues (3)
NetArrayLayer does not accept symbolic arrays:

Dimensions of "Array" specification should be consistent with dims specification:

"Output" dimensions need to be fully specified in order to use NetInitialize:

Tech Notes
Related Guides
History
Text
Wolfram Research (2020), NetArrayLayer, Wolfram Language function, https://reference.wolfram.com/language/ref/NetArrayLayer.html.
CMS
Wolfram Language. 2020. "NetArrayLayer." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/NetArrayLayer.html.
APA
Wolfram Language. (2020). NetArrayLayer. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/NetArrayLayer.html
BibTeX
@misc{reference.wolfram_2025_netarraylayer, author="Wolfram Research", title="{NetArrayLayer}", year="2020", howpublished="\url{https://reference.wolfram.com/language/ref/NetArrayLayer.html}", note=[Accessed: 15-August-2025]}
BibLaTeX
@online{reference.wolfram_2025_netarraylayer, organization={Wolfram Research}, title={NetArrayLayer}, year={2020}, url={https://reference.wolfram.com/language/ref/NetArrayLayer.html}, note=[Accessed: 15-August-2025]}