InputPorts

InputPorts

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

Details

  • InputPorts is typically used in layers that support an arbitrary number of input ports, such as ThreadingLayer, CatenateLayer, DotLayer and PlaceholderLayer.
  • Typical settings for InputPorts include:
  • Automaticinfer number of ports and their shapes from NetChain or NetGraph connectivity
    nn 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
    na 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×
    NetEncoder[]an encoder

Examples

open allclose all

Basic Examples  (1)

By default, multi-input layers such as ThreadingLayer have an undefined number of input ports:

Use InputPorts to create a ThreadingLayer with three ports having default names and unspecified shapes:

Scope  (3)

Create a CatenateLayer with two inputs having explicit names and unspecified shapes:

Create a PlaceholderLayer with four inputs having default names and specified shapes:

Create a DotLayer with two inputs having explicit names and specified shapes:

Wolfram Research (2020), InputPorts, Wolfram Language function, https://reference.wolfram.com/language/ref/InputPorts.html.

Text

Wolfram Research (2020), InputPorts, Wolfram Language function, https://reference.wolfram.com/language/ref/InputPorts.html.

CMS

Wolfram Language. 2020. "InputPorts." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/InputPorts.html.

APA

Wolfram Language. (2020). InputPorts. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/InputPorts.html

BibTeX

@misc{reference.wolfram_2024_inputports, author="Wolfram Research", title="{InputPorts}", year="2020", howpublished="\url{https://reference.wolfram.com/language/ref/InputPorts.html}", note=[Accessed: 21-November-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_inputports, organization={Wolfram Research}, title={InputPorts}, year={2020}, url={https://reference.wolfram.com/language/ref/InputPorts.html}, note=[Accessed: 21-November-2024 ]}