Memory Footprint tflite-micro

63 views
Skip to first unread message

Manfred Schlaegl

unread,
Mar 15, 2023, 5:00:15 AM3/15/23
to SIG Micro
Hi!

I'm new to tflite-micro and have a question regarding the memory-footprint.

I did a few experiments on RISC-V based systems and got the hello_world example running on a (modified) hifive virtual prototype.
The binary has around 650KiB (402KiB stripped) and I've not found a way yet to significantly reduce this.

Did I miss something obvious? Is there any way to reduce the size significantly, e.g. to below 128KiB?
(Eventually we would like to use it on a GD32 RISC-V)

Thanks in advance,
Manfred

Merlin Carson

unread,
Mar 15, 2023, 1:15:53 PM3/15/23
to Manfred Schlaegl, SIG Micro
Manfred,

The hello world example uses the all op resolver:

// This pulls in all the operation implementations
tflite::AllOpsResolver resolver;

You need to use the mutable op resolver to only pull in code for the required ops:

tflite::MicroMutableOpResolver<1> micro_op_resolver:

if (micro_op_resolver.AddFullyConnected() != kTfLiteOk) {
return;
}

Merlin Carson


From: Manfred Schlaegl <turin...@gmail.com>
Sent: Wednesday, March 15, 2023 2:00 AM
To: SIG Micro <mi...@tensorflow.org>
Subject: [EXTERNAL] Memory Footprint tflite-micro
 
CAUTION: The email below is from an external source. Use caution before opening attachments or clicking links.


--
You received this message because you are subscribed to the Google Groups "SIG Micro" group.
To unsubscribe from this group and stop receiving emails from it, send an email to micro+un...@tensorflow.org.
To view this discussion on the web visit https://groups.google.com/a/tensorflow.org/d/msgid/micro/f70d0c4f-f5c4-4a26-bd74-e4354f6b5a67n%40tensorflow.org.

Manfred Schlaegl

unread,
Mar 16, 2023, 4:21:51 AM3/16/23
to SIG Micro, merlin...@skyworksinc.com, Manfred Schlaegl
Hello,

this is really the missing piece! :-)
I was already wondering why tflite-micro adds all operations even for very simple models.
Thanks a lot for the fast response!

best regards,
Manfred
Reply all
Reply to author
Forward
0 new messages