({{, (RefLink[SequenceReverseLayer, paclet:ref/SequenceReverseLayer])[] 
represents a net that reverses the order of an input sequence.}})

OpenersNotesSection(Spacer1)Details and Options

(RefLink[SequenceReverseLayer, paclet:ref/SequenceReverseLayer])[] represents a net that takes a sequence of arrays and outputs a sequence of the same length.

(RefLink[SequenceReverseLayer, paclet:ref/SequenceReverseLayer])[…][input] explicitly computes the output from applying the layer.

(RefLink[SequenceReverseLayer, paclet:ref/SequenceReverseLayer])[…][{(Subscript[input, 1]),(Subscript[input, 2]),…}] explicitly computes an output for each of the (Subscript[input, i]).

When given a (RefLink[NumericArray, paclet:ref/NumericArray]) as input, the output will be a (RefLink[NumericArray, paclet:ref/NumericArray]).

(RefLink[SequenceReverseLayer, paclet:ref/SequenceReverseLayer]) is typically used inside (RefLink[NetChain, paclet:ref/NetChain]), (RefLink[NetGraph, paclet:ref/NetGraph]), etc.

The input and output ports of the net represented by (RefLink[SequenceReverseLayer, paclet:ref/SequenceReverseLayer])[] are:

(RefLink[SequenceReverseLayer, paclet:ref/SequenceReverseLayer])["Input"->shape] allows the shape of the input to be specified. Possible forms for shape are:

OpenersPrimaryExamplesSection(Spacer1)Examples  (7)

OpenersExampleSection0(Spacer1)Basic Examples  (2)

Create a (RefLink[SequenceReverseLayer, paclet:ref/SequenceReverseLayer]):

SequenceReverseLayer[]

Create a (RefLink[SequenceReverseLayer, paclet:ref/SequenceReverseLayer]) that expects a sequence of vectors of size 3:

reverse=SequenceReverseLayer["Input"->{"Varying",3}]

Apply the layer to a sequence of vectors:

reverse[{{1,2,3},{4,5,6},{7,8,9}}]

OpenersExampleSection1(Spacer1)Scope  (3)

Create a (RefLink[SequenceReverseLayer, paclet:ref/SequenceReverseLayer]) that expects a length-3 sequence of 2x2 matrices:

reverse=SequenceReverseLayer["Input"->{3,2,2}]

Apply the layer to a sequence:

reverse[{{{1,2},{4,5}},{{7,8},{10,11}},{{12,13},{14,15}}}]

Create a (RefLink[SequenceReverseLayer, paclet:ref/SequenceReverseLayer]) that expects a sequence of real numbers:

reverse=SequenceReverseLayer["Input"->"Varying"]

Thread the layer across a batch of inputs:

reverse[{{1,2,3},{4,5},{6,7,8,9}}]

Create a (RefLink[SequenceReverseLayer, paclet:ref/SequenceReverseLayer]) that reverses the order of color channels in an image:

reverse=SequenceReverseLayer["Input"->NetEncoder["Image"],"Output"->NetDecoder["Image"]]

Apply it to an image:

reverse[]

OpenersExampleSection3(Spacer1)Applications  (1)

Define a bidirectional (RefLink[BasicRecurrentLayer, paclet:ref/BasicRecurrentLayer]):

binet=NetGraph[{BasicRecurrentLayer[10],BasicRecurrentLayer[10],SequenceReverseLayer[],SequenceReverseLayer[],CatenateLayer[2]},{NetPort["Input"]->1->5,NetPort["Input"]->3,3->2->4->5}]

(RefLink[NetBidirectionalOperator, paclet:ref/NetBidirectionalOperator]) can be used to accomplish the same thing:

NetBidirectionalOperator[BasicRecurrentLayer[10]]

OpenersExampleSection4(Spacer1)Possible Issues  (1)

(RefLink[SequenceReverseLayer, paclet:ref/SequenceReverseLayer]) cannot accept symbolic inputs:

reverse=SequenceReverseLayer[];
reverse[{1,2}]

reverse[{1,z}]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[SequenceMostLayer, paclet:ref/SequenceMostLayer])  ▪  (RefLink[SequenceRestLayer, paclet:ref/SequenceRestLayer])  ▪  (RefLink[SequenceLastLayer, paclet:ref/SequenceLastLayer])  ▪  (RefLink[NetBidirectionalOperator, paclet:ref/NetBidirectionalOperator])  ▪  (RefLink[NetMapOperator, paclet:ref/NetMapOperator])  ▪  (RefLink[BasicRecurrentLayer, paclet:ref/BasicRecurrentLayer])}})}})

({{DocumentationFooterIconsRelatedTutorial.png, ({{Tutorials}, {▪(RefLinkPlain[Neural Networks in the Wolfram Language, paclet:tutorial/NeuralNetworksOverview])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Neural Networks, paclet:guide/NeuralNetworks])}})}})