CatenateLayer
✖
CatenateLayer
represents a net layer that takes a list of input arrays and catenates them at level n.
Details and Options

- CatenateLayer[] is equivalent to CatenateLayer[1].
- CatenateLayer is typically used inside NetGraph.
- CatenateLayer[…][{array1,array2,…}] explicitly computes the output given a list of arrayi.
- For a list of input arrays {array1,array2,…}, the arrayi must be of compatible dimensions. If necessary, the arrayi are replicated as appropriate in order to make them all the same rank.
- If given, the level n is relative to the first dimension of the arrayi with smallest rank.
- Option InputPorts can be used to specify the number, names or shapes of input ports. If InputPorts is not specified, the number of ports and their shapes are inferred from NetChain or NetGraph connectivity.
- Besides input ports, CatenateLayer exposes the following ports for use in NetGraph etc.:
-
"Output" an array - Within a NetGraph, a CatenateLayer can be connected using a single edge of the form {src1,src2,…}catlayer, where catlayer is the name or index of the CatenateLayer, or as multiple separate edges given in the corresponding order, as src1catlayer,src2catlayer,…,srcncatlayer.
- When given a NumericArray as input, the output will be a NumericArray.
- Options[CatenateLayer] gives the list of default options to construct the layer. Options[CatenateLayer[…]] gives the list of default options to evaluate the layer on some data.
- Information[CatenateLayer[…]] gives a report about the layer.
- Information[CatenateLayer[…],prop] gives the value of the property prop of CatenateLayer[…]. Possible properties are the same as for NetGraph.
Examples
open allclose allBasic Examples (3)Summary of the most common use cases
Create a CatenateLayer:

https://wolfram.com/xid/0b7esxf2bjd4uysi-lqs1z4

Create a CatenateLayer that takes two vectors as input and returns a vector:

https://wolfram.com/xid/0b7esxf2bjd4uysi-m3tu8d

Apply this layer to a list of vectors:

https://wolfram.com/xid/0b7esxf2bjd4uysi-i84nc7

Construct a NetGraph with a CatenateLayer, specifying input sizes:

https://wolfram.com/xid/0b7esxf2bjd4uysi-jwzxw3


https://wolfram.com/xid/0b7esxf2bjd4uysi-f929t7

Scope (4)Survey of the scope of standard use cases
Create a CatenateLayer that catenates the rows of two matrices:

https://wolfram.com/xid/0b7esxf2bjd4uysi-bg20s9

Apply the layer to two matrices:

https://wolfram.com/xid/0b7esxf2bjd4uysi-dky1z7

Create a CatenateLayer that catenates a matrix and a vector by repeating the vector:

https://wolfram.com/xid/0b7esxf2bjd4uysi-svrk6j

Apply the layer to an input matrix and vector:

https://wolfram.com/xid/0b7esxf2bjd4uysi-4iuohx


Construct a NetGraph with a CatenateLayer that takes two matrices representing sequences of vectors as input and catenates the vectors:

https://wolfram.com/xid/0b7esxf2bjd4uysi-ce8zcd

Apply the net to two sequences to create a single sequence of vectors:

https://wolfram.com/xid/0b7esxf2bjd4uysi-829k7y

Construct a NetGraph with a CatenateLayer that takes two images and catenates them horizontally:

https://wolfram.com/xid/0b7esxf2bjd4uysi-l1m2a1

Apply the net to two images to create a single image:

https://wolfram.com/xid/0b7esxf2bjd4uysi-1zlsfo

Properties & Relations (1)Properties of the function, and connections to other functions
When the inputs are all the same rank, CatenateLayer[1] computes:

https://wolfram.com/xid/0b7esxf2bjd4uysi-tqmrp1

https://wolfram.com/xid/0b7esxf2bjd4uysi-cfaack


Possible Issues (4)Common pitfalls and unexpected behavior
When catenating arrays of equal rank, the off-level dimensions must be equal:

https://wolfram.com/xid/0b7esxf2bjd4uysi-nix1fw



https://wolfram.com/xid/0b7esxf2bjd4uysi-g9mir7

When catenating arrays of different rank, the dimensions of lower-rank arrays should be suffixes of the dimensions of higher-rank arrays, except for the dimension in each array that corresponds to the level:

https://wolfram.com/xid/0b7esxf2bjd4uysi-7uu2lu


https://wolfram.com/xid/0b7esxf2bjd4uysi-dtgd4f



https://wolfram.com/xid/0b7esxf2bjd4uysi-8vvkon

CatenateLayer cannot catenate on a dynamic dimension:

https://wolfram.com/xid/0b7esxf2bjd4uysi-uu45ur


https://wolfram.com/xid/0b7esxf2bjd4uysi-bu09lv


Catenate on the second dimension, which is not dynamic:

https://wolfram.com/xid/0b7esxf2bjd4uysi-9pv6ap

CatenateLayer cannot accept symbolic inputs:

https://wolfram.com/xid/0b7esxf2bjd4uysi-ggaxyd


https://wolfram.com/xid/0b7esxf2bjd4uysi-56whoo


Wolfram Research (2016), CatenateLayer, Wolfram Language function, https://reference.wolfram.com/language/ref/CatenateLayer.html (updated 2018).
Text
Wolfram Research (2016), CatenateLayer, Wolfram Language function, https://reference.wolfram.com/language/ref/CatenateLayer.html (updated 2018).
Wolfram Research (2016), CatenateLayer, Wolfram Language function, https://reference.wolfram.com/language/ref/CatenateLayer.html (updated 2018).
CMS
Wolfram Language. 2016. "CatenateLayer." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2018. https://reference.wolfram.com/language/ref/CatenateLayer.html.
Wolfram Language. 2016. "CatenateLayer." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2018. https://reference.wolfram.com/language/ref/CatenateLayer.html.
APA
Wolfram Language. (2016). CatenateLayer. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/CatenateLayer.html
Wolfram Language. (2016). CatenateLayer. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/CatenateLayer.html
BibTeX
@misc{reference.wolfram_2025_catenatelayer, author="Wolfram Research", title="{CatenateLayer}", year="2018", howpublished="\url{https://reference.wolfram.com/language/ref/CatenateLayer.html}", note=[Accessed: 07-May-2025
]}
BibLaTeX
@online{reference.wolfram_2025_catenatelayer, organization={Wolfram Research}, title={CatenateLayer}, year={2018}, url={https://reference.wolfram.com/language/ref/CatenateLayer.html}, note=[Accessed: 07-May-2025
]}