CatenateLayer

CatenateLayer[]

represents a net layer that takes a list of input arrays and catenates them.

CatenateLayer[n]

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 all

Basic Examples  (3)

Create a CatenateLayer:

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

Apply this layer to a list of vectors:

Construct a NetGraph with a CatenateLayer, specifying input sizes:

Apply the net to input data:

Scope  (4)

Create a CatenateLayer that catenates the rows of two matrices:

Apply the layer to two matrices:

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

Apply the layer to an input matrix and vector:

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

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

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

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

Properties & Relations  (1)

When the inputs are all the same rank, CatenateLayer[1] computes:

Evaluate on some data:

Possible Issues  (4)

When catenating arrays of equal rank, the off-level dimensions must be equal:

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:

CatenateLayer cannot catenate on a dynamic dimension:

Catenate on the second dimension, which is not dynamic:

CatenateLayer cannot accept symbolic inputs:

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).

BibTeX

@misc{reference.wolfram_2020_catenatelayer, author="Wolfram Research", title="{CatenateLayer}", year="2018", howpublished="\url{https://reference.wolfram.com/language/ref/CatenateLayer.html}", note=[Accessed: 06-May-2021 ]}

BibLaTeX

@online{reference.wolfram_2020_catenatelayer, organization={Wolfram Research}, title={CatenateLayer}, year={2018}, url={https://reference.wolfram.com/language/ref/CatenateLayer.html}, note=[Accessed: 06-May-2021 ]}

CMS

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