How can I make a file containing only weights when using codegen
Mostrar comentarios más antiguos
I did code generation using following command
" codegen -config cfg my_predict -args {inputData} -report "
In the codegen files, there are weights for deeplearning network as shown in below picture.

However, I do not want the weights to be in ".c" file.
I want to make an external file that contains only weights.
Is there a way I can do?
I will be waiting for your reply.
Thank you.
Respuestas (1)
Sayan Saha
el 3 de Dic. de 2023
Editada: Sayan Saha
el 3 de Dic. de 2023
0 votos
Hello,
Looking at the generated code I assume you are generating code for the deep learning network with "TargetLibrary = none" set in the coder configuration object. Currently, it is not possible to generate the weights in a separate file with "TargetLibrary = none" setting. In the upcoming release, we are going to provide an option that will generate the weights in a separate binary file. For now, if you want to generate the weights separately, you'll have to use a "TargetLibrary" other than "none", for example, "mkldnn/arm-compute" for CPU targets or "cudnn/tensorrt" for GPU targets. For these target libraries, the weights are always generated in a separate binary file. Here's the documentation page for how to generate code for "mkldnn" https://www.mathworks.com/help/coder/ug/code-generation-for-deep-learning-networks-with-mkl-dnn.html. Note that the entire process of generating code remains the same, except for setting the "DeepLearningConfig" on the coder configuration object.
Hope this helps,
Sayan
Categorías
Más información sobre Get Started with GPU Coder en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!