is an option to specify the number, names or shapes of output ports for some neural net layers.


OutputPorts
is an option to specify the number, names or shapes of output ports for some neural net layers.
Details

- OutputPorts is typically used in PlaceholderLayer.
- Typical settings for OutputPorts include:
-
Automatic infer number of ports and their shapes from NetChain or NetGraph connectivity n n ports with default names and unspecified shapes {"name1","name2",…} explicit port names with unspecified shapes {shape1,shape2,…} default port names with specified shapes or encoders <|"name1"shape1,…|> explicit port names with specified shapes or encoders - Shape specifications for each port include:
-
"Real" a single real number "Integer" a single integer Restricted["Integer",n] an integer between 1 and n n a vector of length n {n1,n2,…} an array of dimensions n1×n2×… "Varying" a vector whose length is variable {"Varying",n2,n3,…} an array whose first dimension is variable and remaining dimensions are n2×n3×… NetDecoder[…] a decoder
Examples
open all close allBasic Examples (1)
By default, PlaceholderLayer has a single output port:
Use OutputPorts to create a PlaceholderLayer with three ports having default names and unspecified shapes:
Scope (3)
Create a PlaceholderLayer with two outputs having explicit names and unspecified shapes:
Create a PlaceholderLayer with four outputs having default names and specified shapes:
Create a PlaceholderLayer with two outputs having explicit names and specified shapes:
Related Guides
History
Text
Wolfram Research (2020), OutputPorts, Wolfram Language function, https://reference.wolfram.com/language/ref/OutputPorts.html.
CMS
Wolfram Language. 2020. "OutputPorts." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/OutputPorts.html.
APA
Wolfram Language. (2020). OutputPorts. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/OutputPorts.html
BibTeX
@misc{reference.wolfram_2025_outputports, author="Wolfram Research", title="{OutputPorts}", year="2020", howpublished="\url{https://reference.wolfram.com/language/ref/OutputPorts.html}", note=[Accessed: 11-August-2025]}
BibLaTeX
@online{reference.wolfram_2025_outputports, organization={Wolfram Research}, title={OutputPorts}, year={2020}, url={https://reference.wolfram.com/language/ref/OutputPorts.html}, note=[Accessed: 11-August-2025]}