Selectively omit data types at compile-time

22 views
Skip to first unread message

Karim El qouns

unread,
Nov 23, 2021, 11:00:48 AM11/23/21
to TensorFlow Lite


Hello everyone, 

I'm using TFLM, and i want something very optimized in term of footprint. 

My application only requires kTfLiteInt8 kernels.
However, kTfLiteFloat32 and kTfLiteUInt8 kernels are also built into the application.

It would save a considerable amount of code space if there was a way to disable building in the unused data types, e.g.:

switch (input->type) { // Already know in/out types are same. #ifndef TFLITE_FLOAT32_DISABLED case kTfLiteFloat32: return EvalFloat(context, node, params, &data, input, filter, bias, nullptr, nullptr, output); break; #endif #infdef TFLITE_INT8_DISABLED case kTfLiteInt8: return EvalQuantizedPerChannel(context, node, params, &data, input, filter, bias, output, nullptr); break; #endif #ifndef TFLITE_UINT8_DISABLED case kTfLiteUInt8: return EvalQuantized(context, node, params, &data, input, filter, bias, nullptr, nullptr, output); break; #endif default: context->ReportError(context, "Type %s (%d) not supported.", TfLiteTypeGetName(input->type), input->type); return kTfLiteError

Do you have any suggestion please ? 

Thank you 

Karim

Pete Warden

unread,
Nov 24, 2021, 7:51:02 PM11/24/21
to TensorFlow Lite, elqouns...@gmail.com
Hi Karim,
                 we do have some support for this in TFL Micro, there's a bit of documentation in this comment:

Pete

Reply all
Reply to author
Forward
0 new messages