tensorflow / tflite-micro

Infrastructure to enable deployment of ML models to low-power resource-constrained embedded targets (including microcontrollers and digital signal processors).
Apache License 2.0
1.74k stars 769 forks source link

Want to check the variable values of OPs #2597

Closed haoliu001 closed 1 month ago

haoliu001 commented 1 month ago

Hi,

Recently, I wanted to check the values of some variables in OPs, like some variables inside the "inline void FullyConnected(...)" function in the "fully_connected.h" file.

To achieve it, I used the serial port to print it out after uploading the corresponding code. It did not work. Do you have any suggestions for checking these values? (I did not use debugger since my MCUs do not support it well.)

Thanks in advance.

ddavis-2015 commented 1 month ago

@haoliu001

There are a few suggestions and tips I can offer:

  1. Use MicroPrintf or VMicroPrintf from the tensorflow/lite/micro/micro_log.h file, for all of your debug output
  2. Do not use the ErrorReporter class, as that has been deprecated
  3. Did you have BUILD_TYPE=release as part of your make command? If so, all debug output (and associated strings) will be removed from your application. Use BUILD_TYPE= (empty) or BUILD_TYPE=debug as part of your make command. The various build types can be found here.
  4. Did your application call tflite::InitializeTarget()? Calling this method is required for all applications. For some platforms, UART initialization occurs here.
  5. If you are targeting a platform not supported by the TFLM repository, did you implement the target platform methods within system_setup.cc and debug_log.cc? In particular, the methods in the tensorflow/lite/micro/debug_log.h file must be implemented for your platform.

This issue will now be closed. Should you wish to add additional comments to this issue, please feel free to reopen the issue.