0
$\begingroup$

Currently, I am studying Tensorflow Lite For Microcontrollers (TLFM). I have gone over all the tutorials. Now I will write my own code where I will try to detect some anomalies based on the accelerometer data. However, I am just confused about one thing.

To generate TLFM model (I mean that byte array), first we are creating our main model based on the main TensorFlow API. Then, we are generating a Lite model. Finally, we are generating a byte array from that model.

Here are the list of supported TLFM operations. So, if I understand right, when we run ML algorithms on the microcontrollers, we are limited with these. Hence I expect an error, if I add LSTM layer on the main code, and try to generate a lite version out of it.

In one of the tutorials, dense layer was used, which got me confused, because it was not included in the supported operations list. Then, I have realized there was a addFullyConnected() method, which corresponds to a dense layer. Sadly, some of the ops have non-matching names. For example, stack and unstack are named in the supported ops as AddPack() and AddUnpack().

I would be happy, if someone can confirm my understanding, or point out where I am wrong. I have also asked this question in the Google Forum, but no one replied yet.

$\endgroup$
0
$\begingroup$

I had the same problem before few months and sadly, as well I didn't find a list of the supported operators with matching names.

As a quick solution if I wanted to use an operator that I wasn't sure that supported in TFLite I wrote a short TF model with the operators I wanted, tried to convert it, and then looked at the created TFLite model using Netron to see how the conversion worked, so I could look at the docs of the related operator.

$\endgroup$
2
  • $\begingroup$ Does this mean that my understanding is correct? We can only use the allowed operations in the main code? $\endgroup$
    – Mr. Panda
    Sep 8 at 9:11
  • $\begingroup$ As far as I remember you're correct. But it is better to keep playing with the conversion and check the output, it is possible they already added support for running also "unconverted" operations of TF either by replacing it with a combination of other operations or by runing some sandox or something.. $\endgroup$ Sep 8 at 14:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.