SequenceReverseLayer

SequenceReverseLayer[]

represents a net that reverses the order of an input sequence.

Details and Options

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

Examples

open allclose all

Basic Examples  (2)

Create a SequenceReverseLayer:

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

Apply the layer to a sequence of vectors:

Scope  (3)

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

Apply the layer to a sequence:

Create a SequenceReverseLayer that expects a sequence of real numbers:

Thread the layer across a batch of inputs:

Create a SequenceReverseLayer that reverses the order of color channels in an image:

Apply it to an image:

Applications  (1)

Define a bidirectional BasicRecurrentLayer:

NetBidirectionalOperator can be used to accomplish the same thing:

Possible Issues  (1)

SequenceReverseLayer cannot accept symbolic inputs:

Introduced in 2017
 (11.1)