- The input must be of single data type.
- The OutputMode property must be set to sequence."
Issue with LSTM OutputMode='last' in MATLAB Deep Learning HDL Toolbox
9 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Tommaso
el 27 de En. de 2025
Respondida: Wang Chen
el 28 de En. de 2025
Hi all!
I am profiling the performance of the MATLAB Deep Learning HDL Toolbox for an LSTM-based model trained on the IMDb dataset.
I leave below the code I am running:
% Initialize model (code generated by the Deep Network Designer App after importing the tensorflow model)
params = load("params_2025_01_22__11_31_51.mat");
net = dlnetwork;
tempNet = [
sequenceInputLayer(1,"Name","embedding_input","MinLength", 235)
lstmLayer(32,"Name","lstm","outputMode", "last", "BiasInitializer","narrow-normal","InputWeightsInitializer","narrow-normal","RecurrentWeightsInitializer","narrow-normal")
fullyConnectedLayer(1,"Name","dense","Bias",params.dense.Bias,"Weights",params.dense.Weights)
sigmoidLayer("Name","dense_sigmoid")
];
net = addLayers(net,tempNet);
% clean up helper variable
clear tempNet;
net = initialize(net);
% Initialize dlhdl processor with default configuration
hPC = dlhdl.ProcessorConfig
% Optimize configuration for the target network
optimizeConfigurationForNetwork(hPC, net)
hPC.estimateResources
hPC.estimatePerformance(net)
I noticed that the "outputMode='last'" property of the LSTM layer generates the following error when customizing the processor for the target network:
"Error using dnnfpga.macros.verifyRNNLayerParameters
The layer 'lstm' has an OutputMode of 'last' which is not supported.
Error in dnnfpga.macros.createLSTMLayerNet
Error in dnnfpga.macros.Macros.createNet
Error in dnnfpga.compiler.optimizations.preprocessNetworkForDLP
Error in dnnfpga.compiler.cnn5ProcessorFrontend/runFrontend
Error in dnnfpga.compiler.cnn5ProcessorFrontend/doit
Error in dnnfpga.config.CNN5ProcessorConfig/optimizeConfigurationForNetwork
Error in lstm_imdb_test (line 26)
optimizeConfigurationForNetwork(hPC, net)"
I temporarly switched this property to 'sequence' and it seems working.
Please, can you help me find any explanation for this problem?
Thanks in advance for your help!
0 comentarios
Respuesta aceptada
Wang Chen
el 28 de En. de 2025
Hi Tommaso,
The "OutputMode" property = "last" is not supported in Deep Learning HDL Toolbox yet.
"When generating code for a network using this layer, these limitations apply:
As a work-around, you could use "OutputMode" property = "sequence", and pick out last time step's output from the complete output sequences.
Thanks,
Wang
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre FPGA, ASIC, and SoC Development en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!