represents a net layer that produces a list of indices for an input sequence.
SequenceIndicesLayer
represents a net layer that produces a list of indices for an input sequence.
Details and Options
- SequenceIndicesLayer[…] takes a sequence of arrays and outputs a sequence of integers of the same length.
- SequenceIndicesLayer is typically used inside NetChain, NetGraph, etc.
- The following optional parameter can be included:
-
"Maximum" Infinity maximum index to output - SequenceIndicesLayer["Maximum"max] corresponds to the function Min[max,Range[Length[#]]]&.
- The input and output ports of the net represented by SequenceIndicesLayer[] are:
-
"Input" a sequence of n arrays "Output" a sequence of n arrays - SequenceIndicesLayer["Input"shape] allows the shape of the input to be specified. Possible forms for shape include:
-
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[SequenceIndicesLayer] gives the list of default options to construct the layer. Options[SequenceIndicesLayer[…]] gives the list of default options to evaluate the layer on some data.
- Information[SequenceIndicesLayer[…]] gives a report about the layer.
- Information[SequenceIndicesLayer[…],prop] gives the value of the property prop of SequenceIndicesLayer[…]. Possible properties are the same as for NetGraph.
Examples
open all close allBasic Examples (1)
Create a SequenceIndicesLayer that expects a sequence of vectors of size 3:
indices = SequenceIndicesLayer["Input" -> {"Varying", 3}]Apply the layer to a sequence of vectors:
indices[RandomReal[1, {4, 3}]]Scope (2)
Ports (2)
Create a SequenceIndicesLayer that expects a length-3 sequence of 2x2 matrices:
ind = SequenceIndicesLayer["Input" -> {3, 2, 2}]Apply the layer to a sequence:
ind[{{{1, 2}, {4, 5}}, {{7, 8}, {10, 11}}, {{12, 13}, {14, 15}}}]Create a SequenceIndicesLayer that expects a sequence of real numbers:
ind = SequenceIndicesLayer["Input" -> "Varying"]Thread the layer across a batch of inputs:
ind[{{1, 2, 3}, {4, 5}, {6, 7, 8, 9}}]Options (1)
"Maximum" (1)
Create a SequenceIndicesLayer that returns a maximum index of 3:
indices = SequenceIndicesLayer["Maximum" -> 3]Apply the layer to a sequence:
indices[RandomReal[1, {7, 10}]]Possible Issues (1)
SequenceIndicesLayer cannot accept symbolic inputs:
indices = SequenceIndicesLayer[];
indices[{1, 2}]indices[{1, z}]Tech Notes
Related Guides
History
Text
Wolfram Research (2021), SequenceIndicesLayer, Wolfram Language function, https://reference.wolfram.com/language/ref/SequenceIndicesLayer.html.
CMS
Wolfram Language. 2021. "SequenceIndicesLayer." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/SequenceIndicesLayer.html.
APA
Wolfram Language. (2021). SequenceIndicesLayer. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/SequenceIndicesLayer.html
BibTeX
@misc{reference.wolfram_2026_sequenceindiceslayer, author="Wolfram Research", title="{SequenceIndicesLayer}", year="2021", howpublished="\url{https://reference.wolfram.com/language/ref/SequenceIndicesLayer.html}", note=[Accessed: 13-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_sequenceindiceslayer, organization={Wolfram Research}, title={SequenceIndicesLayer}, year={2021}, url={https://reference.wolfram.com/language/ref/SequenceIndicesLayer.html}, note=[Accessed: 13-June-2026]}