NetPort

NetPort[{n,"port"}]

represents the specified port for layer number n in a NetGraph or similar construct.

NetPort[{"name","port"}]

represents the specified port for the layer with the specified name.

NetPort[spec,port]

is treated as equivalent to NetPort[{spec,port}].

NetPort["port"]

represents the specified input or output port for a complete net.

Details

  • When used in NetGraph, NetPort[{layer,"port"}] refers to the named output port of a layer when used on the left-hand side of a rule, and a named input port of a layer when used on the right-hand side of a rule.
  • When used in a NetGraph, NetPort["port"] refers to an input of the entire graph when used on the left-hand side of a rule, and an output of the entire graph when used on the right-hand side of a rule.

Examples

open allclose all

Basic Examples  (3)

Create a graph with two outputs having custom names:

In[1]:=
Click for copyable input
Out[1]=

Create a graph with two inputs having custom names:

In[1]:=
Click for copyable input
Out[1]=

Create a graph with a loss layer:

In[1]:=
Click for copyable input
Out[1]=

Applications  (1)

See Also

NetGraph  NetExtract  NetPortGradient

Introduced in 2016
(11.0)
| Updated in 2017
(11.1)