Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to implement a neural network by using CMSIS-NN? #47

Closed
Raise-me-up opened this issue Mar 13, 2023 · 4 comments
Closed

How to implement a neural network by using CMSIS-NN? #47

Raise-me-up opened this issue Mar 13, 2023 · 4 comments
Assignees
Labels
question Further information is requested

Comments

@Raise-me-up
Copy link

Is there any tutorial? I am confused about the cmsis-nn transform of nn.lstm, nn.layernorm, nn.prelu etc。

@felix-johnny felix-johnny self-assigned this Mar 13, 2023
@felix-johnny felix-johnny added the question Further information is requested label Mar 13, 2023
@felix-johnny
Copy link
Contributor

@Raise-me-up thanks for the question. CMSIS-NN is an optimization library that provides optimization for some of the ML operators in TensorFlow Lite for Microcontrollers framework.

https://github.com/ARM-software/CMSIS-NN/tree/main/Examples has some examples to see how one can get started on it.

@Raise-me-up
Copy link
Author

@felix-johnny Thanks for your reply! I have read your example. However, it is based on Tensorflow lite micro library, and I just want to implement a neural network by using cmsis-nn purely, not the third party library. Are there any other examples?

@felix-johnny
Copy link
Contributor

@Raise-me-up Sorry, there isn't one..CMSIS-NN is not a ML framework(like Tensor Flow Lite for Microcontrollers(TFLM)) but rather an optimization library. It implements int8 optimizations as per TFLM's int8 quantization spec and uses TFLM's reference kernels as fallback when there are operators in a network that are not supported by CMSIS-NN.

If you are starting off with a tflite model, you could potentially extract the hyper parameters and make your own version of interface like in https://github.com/tensorflow/tflite-micro/tree/main/tensorflow/lite/micro/kernels/cmsis_nn . This creates complexity, overhead and the loss scalability and robustness. The upside will be a few kB's of program memory saved.
I hope that helps answer a few thoughts.

@Raise-me-up
Copy link
Author

@felix-johnny OK! Thanks for your detailed reply!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants