code generation for LSTM NN
4 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I generated the C/C++ code for a trained LSTM NN on a 2021b Matlab
the type of mynet;/* '<Root>/MATLAB Function' */
c_coder_ctarget_DeepLearningN_T
is missed.
How to solve the problem?
Giuseppe
1 commentaire
Hariprasad Ravishankar
le 10 Fév 2022
Can you provide some reproduction files to reproduce the issue at our end?
Particularly, I'd like to take a look at the entry point function and how the network was loaded.
Hari
Réponses (3)
Giuseppe Menga
le 10 Fév 2022
1 commentaire
Hariprasad Ravishankar
le 10 Fév 2022
Yes, we can specify vanilla C/C++ code generation for deep learning models by using the 'none' deep learning target library.
The link below showcases an example using MATLAB coder:
Here is another example using LSTMs:
If you are using Simulink, you can refer to the example below:
By default, the code-generator calls into OpenMP to parallelize the loops. This can be disabled by setting the EnableOpenMP option on the coder config to false as shown here:
To generate code for SIMD and packed data types you may refer to the following page:
Please let me know if this answer was helpful. I would also recommend to try out the new enahncements to the code-generator when R2022a goes live as there are have been some performance optimizations for the matrix multiplication operations in RNNs for single threaded applications.
Hari
Giuseppe Menga
le 3 Mar 2022
1 commentaire
Hariprasad Ravishankar
le 3 Mar 2022
Modifié(e) : Hariprasad Ravishankar
le 9 Mar 2022
Hi Giueseppe,
>>in spite of no libraries and no enable openMP in the configuration, in the initialize and terminate functions of the net the call to.
This is not expected. Can you please share any simple reproduction scripts and commands to reproduce this issue? We will look into it.
With reference to your other question on training of LSTM, I'm afraid I do not have the expertise to answer this question. However, based on the description it seems you are training on the validation set which may cause issues such as overfitting on the validation set. It is best to keep these mutually exclusive.
I would recommend you to post this question in a new MATLAB Answers post and tag "Deep Learning Toolbox" product. This will help to make your question more visible to experts in the Deep Learning/Neural Networks domain.
Hari
Giuseppe Menga
le 3 Mar 2022
1 commentaire
Hariprasad Ravishankar
le 9 Mar 2022
Thanks for clarifying the issue. You are right in that the "Check for Run-Time Issues" settings do not get carried to the "Generate Code" step and you have to set the same configuration before generating code.
I will forward this feedback to the concerned teams.
Hari
Voir également
Catégories
En savoir plus sur Simulink Coder dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!