cpetig / tflite_micro_compiler

generate tflite micro code which bypasses the interpreter (directly calls into kernels)
Apache License 2.0
77 stars 26 forks source link

Use enum for indexing g_registrations #7

Closed cpetig closed 4 years ago

cpetig commented 4 years ago

E.g. g_registrations[0] = tflite::ops::micro::Register_QUANTIZE(); status = g_registrations[0]->invoke(&g_ctx, &g_nodes[0]); becomes g_registrations[GREG_QUANTIZE] = tflite::ops::micro::Register_QUANTIZE(); status = g_registrations[GREG_QUANTIZE]->invoke(&g_ctx, &g_nodes[0]);

especially the second change helps a lot during debugging and understanding the resulting code.

cpetig commented 4 years ago

I am not that happy with my choice of prefix (GREG_), though

rafzi commented 4 years ago

Slightly related discussion on naming:

Since all those internal definitions are in an anonymous namespace anyways: Should we drop the model naming prefix and "g_" prefix? None of the names are relevant for linking.

So for example:

registrations[REG_QUANTIZE] = tflite::ops::micro::Register_QUANTIZE();
status = registrations[REG_QUANTIZE]->invoke(&ctx, &nodes[0]);
cpetig commented 4 years ago

Should we drop the model naming prefix and "g_" prefix?

+1 from me (feels like I should say +2 remembering my Jira days)