represents a net that takes a sequence of inputs and removes its first element.
SequenceRestLayer
represents a net that takes a sequence of inputs and removes its first element.
Details and Options
- SequenceRestLayer[] represents a net that takes a sequence of arrays and outputs a sequence of arrays of length one less than the input sequence length.
- SequenceRestLayer[…][input] explicitly computes the output from applying the layer.
- SequenceRestLayer[…][{input1,input2,…}] explicitly computes an output for each of the inputi.
- When given a NumericArray as input, the output will be a NumericArray.
- SequenceRestLayer is typically used inside NetChain, NetGraph, etc.
- The input and output ports of the net represented by SequenceRestLayer[] are:
-
"Input" a sequence of n arrays "Output" a sequence of n-1 arrays - SequenceRestLayer["Input"shape] allows the shape of the input to be specified. Possible forms for shape are:
-
n a 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[SequenceRestLayer] gives the list of default options to construct the layer. Options[SequenceRestLayer[…]] gives the list of default options to evaluate the layer on some data.
- Information[SequenceRestLayer[…]] gives a report about the layer.
- Information[SequenceRestLayer[…],prop] gives the value of the property prop of SequenceRestLayer[…]. Possible properties are the same as for NetGraph.
Examples
open all close allBasic Examples (2)
Create a SequenceRestLayer:
SequenceRestLayer[]Create a SequenceRestLayer that expects a sequence of vectors of size 3:
rest = SequenceRestLayer["Input" -> {"Varying", 3}]Apply the layer to a sequence:
rest[{{1, 2, 3}, {4, 5, 6}, {7, 8, 9}}]Scope (3)
Ports (3)
Create a SequenceRestLayer that expects a length-3 sequence of 2x2 matrices:
rest = SequenceRestLayer["Input" -> {3, 2, 2}]Apply the layer to a sequence:
rest[{{{1, 2}, {4, 5}}, {{7, 8}, {10, 11}}, {{12, 13}, {14, 15}}}]Create a SequenceRestLayer that expects a sequence of real numbers:
rest = SequenceRestLayer["Input" -> "Varying"]Thread the layer across a batch of inputs:
rest[{{1, 2}, {4, 5, 3}, {1, 5}, {6, 7, 8, 9}}]Create a SequenceRestLayer that drops the first color channel from an RGB image, turning it into a two-channel image:
rest = SequenceRestLayer["Input" -> NetEncoder["Image"], "Output" -> NetDecoder["Image"]]rest[[image]]Possible Issues (2)
SequenceRestLayer cannot be applied to sequences of length less than 2:
SequenceRestLayer[]@{2}SequenceRestLayer cannot accept symbolic inputs:
rest = SequenceRestLayer[];
rest[{1, 2}]rest[{1, z}]Tech Notes
Related Guides
History
Text
Wolfram Research (2017), SequenceRestLayer, Wolfram Language function, https://reference.wolfram.com/language/ref/SequenceRestLayer.html.
CMS
Wolfram Language. 2017. "SequenceRestLayer." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/SequenceRestLayer.html.
APA
Wolfram Language. (2017). SequenceRestLayer. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/SequenceRestLayer.html
BibTeX
@misc{reference.wolfram_2026_sequencerestlayer, author="Wolfram Research", title="{SequenceRestLayer}", year="2017", howpublished="\url{https://reference.wolfram.com/language/ref/SequenceRestLayer.html}", note=[Accessed: 13-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_sequencerestlayer, organization={Wolfram Research}, title={SequenceRestLayer}, year={2017}, url={https://reference.wolfram.com/language/ref/SequenceRestLayer.html}, note=[Accessed: 13-June-2026]}