SequenceMostLayer

SequenceMostLayer[]

represents a net that takes a sequence of inputs and removes its last element.

Details and Options

  • SequenceMostLayer[] represents a net that takes a sequence of arrays and outputs a sequence of arrays of length one less than the input sequence length.
  • SequenceMostLayer[][input] explicitly computes the output NumericArray object from applying the layer.
  • SequenceMostLayer[][{input1,input2,}] explicitly computes an output for each of the inputi.
  • When given a NumericArray as input, the output will be a NumericArray.
  • SequenceMostLayer is typically used inside NetChain, NetGraph, etc.
  • The input and output ports of the net represented by SequenceMostLayer[] are:
  • "Input"a sequence of n arrays
    "Output"a sequence of n-1 arrays
  • SequenceMostLayer["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 arrays of dimensions d1×d2×
    {"Varying",d1,d2,}varying number of arrays of dimensions d1×d2×
  • Options[SequenceMostLayer] gives the list of default options to construct the layer. Options[SequenceMostLayer[]] gives the list of default options to evaluate the layer on some data.
  • Information[SequenceMostLayer[]] gives a report about the layer.
  • Information[SequenceMostLayer[],prop] gives the value of the property prop of SequenceMostLayer[]. Possible properties are the same as for NetGraph.

Examples

open allclose all

Basic Examples  (2)

Create a SequenceMostLayer:

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

Apply the layer to a sequence:

Scope  (3)

Create a SequenceMostLayer that expects a length-3 sequence of 2x2 matrices:

Apply the layer to a sequence:

Create a SequenceMostLayer that expects a sequence of real numbers:

Thread the layer across a batch of inputs:

Create a SequenceMostLayer that drops the last color channel from an RGB image, turning it into a two-channel image:

Apply it to an image:

Possible Issues  (2)

SequenceMostLayer cannot be applied to sequences of length less than 2:

SequenceMostLayer cannot accept symbolic inputs:

Introduced in 2017
 (11.1)