How do I create a "TimeDistributed TensorFlow-Keras" deep network layer in MATLAB?

7 views (last 30 days)
I am trying to create a neural network that performs sequence-to-sequence classification and would like to create the equivalent of a "TimeDistributed TensorFlow-Keras" deep network layer. How can I create such a layer in MATLAB?

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 8 Jan 2024
A "TimeDistributed TensorFlow-Keras" deep network layer can be implemented in MATLAB by wrapping an operation between "sequenceFoldingLayer" and "sequenceUnfoldingLayer" layers from the Deep Learning Toolbox.
1. The "sequenceFoldingLayer" layer brings the batch and time dimensions to a single batch dimension. Please refer to the following documentation page for more information on the layer: 
2. The operation (e.g., a fully connected layer) will be time-distributed since these operations are independent for each batch, and the time dimension is now wrapped in the batch dimension.
3. The "sequenceUnfoldingLayer" layer reintroduces the time dimension by reverting the collapse operation in the sequence folding layer. Please refer to the following documentation page for more information on the layer: 

More Answers (0)

Categories

Find more on Deep Learning Toolbox in Help Center and File Exchange

Products


Release

R2023b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!