Skip to content

Library size is not 16KB as advertised. What are ways to reduce size? #3069

@aberriangw

Description

@aberriangw

I have the same issue as in #1815, except the build size is 1.1MB even with BUILD_TYPE=release. That is, if I run the command

make -f tensorflow/lite/micro/tools/make/Makefile TARGET=cortex_m_generic TARGET_ARCH=cortex-m4+fp microlite -j16 BUILD_TYPE=release

then the resulting static library gen/cortex_m_generic_cortex-m4+fp_release_gcc/lib/libtensorflow-microlite.a is 1.1MB, not anywhere near the 16KB I expected.

Here are my questions:

  • The documentation here claims that the "core runtime" fits into 16KB on a Cortex M3. Doing the same command as above but with TARGET_ARCH=cortex-m3 yields a 1.1MB file gen/cortex_m_generic_cortex-m3_release_gcc/lib/libtensorflow-microlite.a. Is there some "core" that is only 16KB, whereas the rest of what's included in the static library increases the size to 1.1MB? If so, how can I isolate this "core" or understand better what the core library is? Or, rather, has the size increased to 16KB over time as the library has been further developed, and the documentation is just out of date?

  • Is it possible to compile a model into a binary using this repo, such that (1) the binary only contains the necessary operators to run the model, and not the entirety of the TFLM library; and (2) the binary does not have any external dependency on TFLM? I feel like this would solve any size issues. I tried to compile the Hello World program into a binary as prescribed here, but compilation failed.

Thanks for your help!
P.S. I would have reopened the earlier issue, but I don't have permission, and I wasn't sure that anyone would have seen if I left a comment.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions