Main Content

sequenceFoldingLayer

(Not recommended) Sequence folding layer

SequenceFoldingLayer objects are not recommended. Most neural networks specified as a dlnetwork object do not require sequence folding and unfolding layers. In most cases, deep learning layers have the same behavior when there is no folding or unfolding layer. Otherwise, instead of using a SequenceFoldingLayer to manipulate the dimensions of data for downstream layers, define a custom layer functionLayer layer object that operates on the data directly. For more information, see Version History.

Description

A sequence folding layer converts a batch of image sequences to a batch of images. Use a sequence folding layer to perform convolution operations on time steps of image sequences independently.

To use a sequence folding layer, you must connect the miniBatchSize output to the miniBatchSize input of the corresponding sequence unfolding layer.

Creation

Description

layer = sequenceFoldingLayer creates a sequence folding layer.

layer = sequenceFoldingLayer('Name',Name) creates a sequence folding layer and sets the optional Name property using a name-value pair. For example, sequenceFoldingLayer('Name','fold1') creates a sequence folding layer with the name 'fold1'. Enclose the property name in single quotes.

example

Properties

expand all

Layer name, specified as a character vector or a string scalar. For Layer array input, the trainNetwork function automatically assigns names to layers with the name "".

The SequenceFoldingLayer object stores this property as a character vector.

Data Types: char | string

Number of inputs to the layer, returned as 1. This layer accepts a single input only.

Data Types: double

Input names, returned as {'in'}. This layer accepts a single input only.

Data Types: cell

Number of outputs of the layer.

The layer has two outputs:

  • 'out' – Output feature map corresponding to reshaped input.

  • 'miniBatchSize' – Size of the mini-batch passed into the layer. This output must be connected to the 'miniBatchSize' input of the corresponding sequence unfolding layer.

Data Types: double

Output names of the layer.

The layer has two outputs:

  • 'out' – Output feature map corresponding to reshaped input.

  • 'miniBatchSize' – Size of the mini-batch passed into the layer. This output must be connected to the 'miniBatchSize' input of the corresponding sequence unfolding layer.

Data Types: cell

Examples

collapse all

Create a sequence folding layer.

Create a sequence folding layer with name the 'fold1'.

layer = sequenceFoldingLayer('Name','fold1')
layer = 
  SequenceFoldingLayer with properties:

           Name: 'fold1'
     NumOutputs: 2
    OutputNames: {'out'  'miniBatchSize'}

Extended Capabilities

expand all

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

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

Version History

Introduced in R2019a

collapse all