SequenceLastLayer

SequenceLastLayer[]

represents a net that takes a sequence of inputs and returns the last element of the sequence.

Details and Options

  • SequenceLastLayer[] represents a net that takes a sequence of tensors and outputs a single tensor.
  • SequenceLastLayer[][input] explicitly computes the output from applying the layer.
  • SequenceLastLayer is typically used inside NetChain, NetGraph, etc.
  • The input and output ports of the net represented by SequenceLastLayer[] are:
  • "Input"a sequence of rank-n tensors
    "Output"a rank-n tensor
  • SequenceLastLayer["Input"->shape] allows the shape of the input to be specified. Possible forms for shape are:
  • na sequence of n numbers
    "Varying"a sequence of numbers of varying length
    {len,d1,d2,}sequence of len tensors of dimensions d1×d2×
    {"Varying",d1,d2,}varying number of tensors of dimensions d1×d2×

Examples

open allclose all

Basic Examples  (2)

Create a SequenceLastLayer:

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

Create a SequenceLastLayer that expects a sequence of vectors of size 3:

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

Apply the layer to a sequence:

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

Scope  (2)

Applications  (1)

Possible Issues  (1)

See Also

SequenceMostLayer  SequenceRestLayer  SequenceReverseLayer  NetMapOperator  Last  BasicRecurrentLayer

Introduced in 2017
(11.1)