How to solve "DataType error: DataType 0 is not recognized in Java." when using tensorflowlite in android
I'm sorry for not providing enough information. This is the project exported by Android Studio [onDeviceTrainingEx.zip](https://github.com/tensorflow/tensorflow/files/13278511/onDeviceTrainingEx.zip), it is built on Windows 10(but the model is converted on Linux).  Hi @TiAmoLip 

I have observed that you are using TF 2.7. The Java API's DataType enum are updated with different releases.

Could you please try with latest version TF2.14 for TFLite conversion as well as in gradle file and let us know if the issue still persist?

Thanks. Thank you for giving me the guidance!
In fact I have recently tried multiple versions of TF to convert model, including TF2.9, TF2.12, TF2.7 while using TFLite 2.9 in gradle, and they all ended up with this issue.
This time, I tried to use TF2.14 to convert TFLite model and tensorflow-lite 2.14 in build.gradle, but there is another bug when loading model:
```
val options = Interpreter.Options()
val modelFile = FileUtil.loadMappedFile(context,"model.tflite")
interpreter = Interpreter(modelFile,options)//error occurs
```
I use debug tools in Android studio and find the error occurs in the last line above. The code behind it is read-only which I cannot modify.
This bug causes the app to crash as soon as it opens, and the error message is:
```
A  Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0xd1240004 in tid 3096 (evicetrainingex), pid 3096 (evicetrainingex)
pid: 3096, tid: 3096, name: evicetrainingex  >>> com.example.ondevicetrainingex <<<
#00 pc 04b24fa0  /data/app/~~bsUTaPTP2IFBO5JbatUS4Q==/com.example.ondevicetrainingex-N2chS4trwgoA4qPzksoikA==/base.apk!libtensorflowlite_flex_jni.so (offset 0xdfd000)
#01 ......
......
```
Then I tried to downgrade lite in gradle, finding that 2.12 produced the same result, and 2.9 still caused the issue "Datatype error".  Hi @TiAmoLip, it looks like your inputs and outputs are not a type supported by the model. You are using MutableMap<String, Any> for both (In TransferLearningHelper.kt:56), I don't know the exact characteristics of your model but typically I've seen people used the right sized ByteBuffers: https://firebase.google.com/docs/ml/android/use-custom-models#run_the_interpreter Here's an example which may help guide you. Let me know if that somehow works for you or if you run into a different problem.

Thanks. Hi @pkgoogle, I'm excited to tell you that this problem has been solved! Thank you for the docs you provided, but the problem may be the cause of the incorrect key of my input hashmap. This doc reminds me to check the signature list of my model, and I found my input keys are "features" and "labels", which dismatches the output of:
```
signatures = interpreter.get_signature_list()
print(signatures) #{'infer': {'inputs': ['x'], 'outputs': ['output']}, 'train': {'inputs': ['x', 'y'], 'outputs': ['loss']}}
```
After I modified the key of input hash map, I found that both float and ByteBuffer can successfully run.  
Deeply appreciate your help. Are you satisfied with the resolution of your issue?
<a href="https://docs.google.com/forms/d/e/1FAIpQLSfaP12TRhd9xSxjXZjcZFNXPGk4kc1-qMdv3gc6bEP90vY1ew/viewform?entry.85265664=Yes&entry.2137816233=https://github.com/tensorflow/tensorflow/issues/62327">Yes</a>
<a href="https://docs.google.com/forms/d/e/1FAIpQLSfaP12TRhd9xSxjXZjcZFNXPGk4kc1-qMdv3gc6bEP90vY1ew/viewform?entry.85265664=No&entry.2137816233=https://github.com/tensorflow/tensorflow/issues/62327">No</a>

I am trying to perform on device training in kotlin with tensorflowlite in Android Studio. I followed the tutorial from [text](https://tensorflow.google.cn/lite/examples/on_device_training/overview) and the github page on it, but I am trying to train a MLP instead of CNN, and the data is generated by hand. I learnt from the example code from github codes in that web and as long as the training process began, the error occured and the logcat is as follow:
```
FATAL EXCEPTION: pool-2-thread-1
Process: com.example.deeplearningforinfer, PID: 32094
java.lang.IllegalArgumentException: DataType error: DataType 0 is not recognized in Java.
at org.tensorflow.lite.DataTypeUtils.fromC(DataTypeUtils.java:69)
at org.tensorflow.lite.TensorImpl.<init>(TensorImpl.java:479)
at org.tensorflow.lite.TensorImpl.fromSignatureInput(TensorImpl.java:49)
at org.tensorflow.lite.NativeSignatureRunnerWrapper.getInputTensor(NativeSignatureRunnerWrapper.java:49)
at org.tensorflow.lite.NativeInterpreterWrapper.getInputTensor(NativeInterpreterWrapper.java:418)
at org.tensorflow.lite.NativeInterpreterWrapper.runSignature(NativeInterpreterWrapper.java:193)
at org.tensorflow.lite.Interpreter.runSignature(Interpreter.java:261)
at com.example.deeplearningforinfer.TransferLearningHelper.train(TransferLearningHelper.kt:64)
at com.example.deeplearningforinfer.TransferLearningHelper.startTraining$lambda$5(TransferLearningHelper.kt:146)
at com.example.deeplearningforinfer.TransferLearningHelper.$r8$lambda$7My04QIePTcHhSGX3SRRzpn0w1Y(Unknown Source:0)
```
The android device is Pixel 6(API level 30), and I also test it on my vivo neo5(API 33). The version of tensorflow for converting the model is 2.7.0 and on Ubuntu 20.04.

The full description is [stackoverflow](https://stackoverflow.com/questions/77332595/how-to-solve-datatype-error-datatype-0-is-not-recognized-in-java-when-using)
