主要内容

depthConcatenationLayer

Depth concatenation layer

Description

A depth concatenation layer takes inputs that have the same height and width and concatenates them along the third dimension (the channel dimension).

Specify the number of inputs to the layer when you create it. The inputs have the names'in1','in2',...,'inN', whereNis the number of inputs. Use the input names when connecting or disconnecting the layer by usingconnectLayersordisconnectLayers.

Creation

Description

example

layer= depthConcatenationLayer(numInputs)creates a depth concatenation layer that concatenatesnumInputsinputs along the third (channel) dimension. This function also sets theNumInputsproperty.

example

layer= depthConcatenationLayer(numInputs,'Name',name)also sets theNameproperty.

Properties

expand all

Number of inputs to the layer, specified as a positive integer greater than or equal to 2.

The inputs have the names'in1','in2',...,'inN', whereNisNumInputs. For example, ifNumInputsis 3, then the inputs have the names'in1','in2','in3'. Use the input names when connecting or disconnecting the layer using theconnectLayersordisconnectLayers功能.

Layer name, specified as a character vector or a string scalar. ForLayerarray input, thetrainNetwork,assembleNetwork,layerGraph,dlnetwork功能automatically assign names to layers withNameset to''.

Data Types:char|string

Input names, specified as{'in1','in2',...,'inN'}, whereNis the number of inputs of the layer.

Data Types:cell

This property is read-only.

Number of outputs of the layer. This layer has a single output only.

Data Types:double

This property is read-only.

Output names of the layer. This layer has a single output only.

Data Types:cell

Examples

collapse all

Create a depth concatenation layer with two inputs and the name'concat_1'.

concat = depthConcatenationLayer(2,'Name','concat_1')
concat = DepthConcatenationLayer with properties: Name: 'concat_1' NumInputs: 2 InputNames: {'in1' 'in2'}

Create two ReLU layers and connect them to the depth concatenation layer. The depth concatenation layer concatenates the outputs from the ReLU layers.

relu_1 = reluLayer('Name','relu_1'); relu_2 = reluLayer('Name','relu_2'); lgraph = layerGraph; lgraph = addLayers(lgraph,relu_1); lgraph = addLayers(lgraph,relu_2); lgraph = addLayers(lgraph,concat); lgraph = connectLayers(lgraph,'relu_1','concat_1/in1'); lgraph = connectLayers(lgraph,'relu_2','concat_1/in2'); plot(lgraph)

Figure contains an axes object. The axes object contains an object of type graphplot.

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

GPU Code Generation
Generate CUDA® code for NVIDIA® GPUs using GPU Coder™.

Introduced in R2017b