CatenateLayer

CatenateLayer[]

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

CatenateLayer[n]

represents a net layer that takes a list of input tensors and catenates them at level n.

Details and Options

  • CatenateLayer[] is equivalent to CatenateLayer[1].
  • CatenateLayer has a single input port that must be a list of tensors.
  • 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 src1->catlayer,,src2catlayer,.
  • CatenateLayer[][{tensor1,tensor2,}] explicitly computes the output given a list of tensori.
  • CatenateLayer is typically used inside NetGraph.
  • CatenateLayer exposes the following ports for use in NetGraph etc.:
  • "Input"a list of tensors
    "Output"a tensor
  • For a list of input tensors {tensor1,tensor2,}, the tensori must be of compatible dimensions. If necessary, the tensori 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 tensori with smallest rank.
  • When it cannot be inferred from other layers in a larger net, the option "Input"{shape1,shape2,} can be used to fix the dimensions of the input tensors to CatenateLayer. Each shape shapei can be one of the following:
  • {d} orda vector of dimensions d
    {d1,d2,}a tensor of dimensions d1×d2×
    {"Varying",}a tensor with a varying initial dimension

Examples

open allclose all

Basic Examples  (3)

Create a CatenateLayer:

In[1]:=
Click for copyable input
Out[1]=

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

In[1]:=
Click for copyable input
Out[1]=

Apply this layer to a list of vectors:

In[2]:=
Click for copyable input
Out[2]=

Construct a NetGraph with a CatenateLayer, specifying input sizes:

In[1]:=
Click for copyable input
Out[1]=

Apply the net to input data:

In[2]:=
Click for copyable input
Out[2]=

Scope  (4)

Properties & Relations  (1)

Possible Issues  (4)

See Also

TotalLayer  ReshapeLayer  NetChain  NetGraph  NetTrain

Introduced in 2016
(11.0)