Is it so that output size of the lstmLayer is equal to the number of hidden units used in the lstmLayer?

2 views (last 30 days)
If i use a CNN-LSTM model, is it so that output size of the lstmLayer is equal to the number of hidden units used in the lstmLayer?

Answers (1)

Sai Pavan
Sai Pavan on 22 Sep 2023
Edited: Sai Pavan on 27 Sep 2023
Hi Debojit,
I understand that you are trying to know whether the output size of the lstmlayer is equal to the number of hidden units of a lstmLayer in a CNN-LSTM model.
No, the output size of the lstmLayer in a CNN-LSTM model in MATLAB is not necessarily equal to the number of hidden units used in the layer.
In a CNN-LSTM model, the lstmLayer is typically used as a recurrent layer to process sequential data. The output size of the lstmLayer depends on the configuration of the layer and the specific problem you are working on. The lstmLayer in MATLAB has a couple of options that can affect the output size, such as the number of hidden units (numHiddenUnits) and the output mode ('sequence' or 'last').
  • If the 'OutputMode' is set to 'sequence', the output size of the lstmLayer will be a sequence of outputs with a size of [sequenceLength, numHiddenUnits].
  • If the 'OutputMode' is set to 'last', the output size will be [1, numHiddenUnits].
  • It's important to note that the output of the lstmLayer is typically followed by other layers in the network, such as fully connected layers or convolutional layers, which can further modify the size and shape of the output. Please refer the following link to learn more about LSTM: https://www.mathworks.com/help/deeplearning/ref/nnet.cnn.layer.lstmlayer.html
Therefore, the output size of the lstmLayer in a CNN-LSTM model depends on the specific configuration and the subsequent layers in the network and not necessarily have to be equal to the number of hidden units in lstmlayer.
Hope this answers your question.

Categories

Find more on Deep Learning with GPU Coder in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!