Issue with On-device Training using Shared Library

Hi everyone,

I’m currently running an on-device training experiment and need to use the TensorFlow Lite shared library through native-lib to implement this functionality. I have noticed that some ops require the use of the tensorflow-lite-select-tf-ops shared library.

I have imported and, which I downloaded from Maven, into my project. My question is, how can I replace with during training to support the ops that are not supported by

Thank you.

Hi @ODT_novice, place file in the location of The model will choose the file automatically. Thank you.

Dear Kiran_Sai_Ramineni,
Thank you for your response. Initially, I added these two libraries in the CMakeLists.txt file:
add_library( tensorflowlite_jni SHARED IMPORTED )
set_target_properties( tensorflowlite_jni PROPERTIES IMPORTED_LOCATION ${JNI_DIR}/${ANDROID_ABI}/ )

add_library( tensorflowlite_flex_jni SHARED IMPORTED )
set_target_properties( tensorflowlite_flex_jni PROPERTIES IMPORTED_LOCATION ${JNI_DIR}/${ANDROID_ABI}/ )

I used the following command to invoke the train signature in my train.tflite file:

However, I encountered the following error:
Select TensorFlow op(s), included in the given model, is(are) not supported by this interpreter.
Make sure you apply/link the Flex delegate before inference.
For the Android, it can be resolved by adding “org.tensorflow:tensorflow-lite-select-tf-ops” dependency.
Node number 1409 (FlexBroadcastGradientArgs) failed to prepare.

I am unable to use to support this operation.
If I directly remove from my project, I encounter the following error:
undefined reference to `TfLiteSignatureRunnerInvoke’

I would like to know how to run these two libraries together if I want to use the C API for on-device training. How can I make support the operations that does not support?

Thank you.

Hi Kiran_Sai_Ramineni, “modified by moderator”

Thank you for sharing your solution with @ODT_novice! It’s always helpful to see community members supporting each other with tips and insights.

For those who might encounter a similar issue, placing the file in the same location as libtensorflowlite_jni so can help the model automatically choose the appropriate file.

Your contribution is greatly appreciated!

Best regards,