PartLayer

PartLayer[i]

represents a net layer that gives the i^(th) part of the input.

PartLayer[m;;n]

gives parts m through n.

Details and Options

  • PartLayer[][input] explicitly computes the output from applying the layer to input.
  • PartLayer[][{input1,input2,}] explicitly computes outputs for each of the inputi.
  • PartLayer exposes the following ports for use in NetGraph etc.:
  • "Input"a tensor
    "Output"a tensor
  • PartLayer is typically used inside NetChain, NetGraph, etc.
  • PartLayer normally infers the dimensions of its input from its context in NetChain etc. To specify the dimensions explicitly as {n1,n2,}, use PartLayer["Input"->{n1,n2,}].
  • PartLayer[m;;n] gives an output that is of the same rank as the input, whereas PartLayer[i] gives an output that is one rank smaller.

Examples

open allclose all

Basic Examples  (2)

Create a PartLayer that takes the second part of a tensor:

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

Create a PartLayer that takes the second part of a tensor:

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

Apply the layer to a vector:

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

Scope  (4)

Possible Issues  (1)

See Also

Part  ReshapeLayer  FlattenLayer  ReplicateLayer  TransposeLayer  NetChain  NetGraph

Introduced in 2017
(11.1)