-
Notifications
You must be signed in to change notification settings - Fork 214
DataType 20 is not recognized in Java (version 1.15.0) #249
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
It looks like you're still using the TF1 Java bindings (1.15.0), which doesn't support resource variables (DataType 20), as they don't exist in TF1. You'll want to use one of the newer artifacts from this repo (see the README). We don't support resource variables yet on an API level, but the ops (i.e. If you still have issues when using the artifacts from this repo, please update this issue, as this is definitely something we should support. |
As seen in (tensorflow/tensorflow#41212) and (xamarin/XamarinComponents#1079), this is a common issue. Even when one uses tensorflow-lite. I am using Tensorflow 2.2 in Python to create the model and saving it as In Java the latest version is for org.tensorflow is 1.15.0. Am I wrong? I have attached the full code I am using (Python and Java). It can be used to reproduce the issue and solve the problem. In case there is a solution, what should I change in the pom.xml file. Sorry, I am new in Java. A direct help in editing my code will be more helpful. thanks. |
if I use add the following to the pom.xml; then I have problem convertin float to tensor;
|
The TF 1.15 bindings are old and no longer supported. This project is for the newer Java bindings which track the upstream TF Python releases. Our most recent release |
Here is the solution; (#258) |
I am trying to write a FiJi plugin in java. I have trained models in Python Tensorflow Version 2.2.0. However, when I try to perform prediction in Java I have the following problem:
`test_images\test_00001.png
28-28
1
4
inputTensor is: FLOAT tensor with shape [1, 28, 28, 1]
FLOAT
1.15.0
2021-03-21 18:12:47.782329: I tensorflow/cc/saved_model/reader.cc:31] Reading SavedModel from: CreateModelWithPythonTensorflow/model
2021-03-21 18:12:48.073847: I tensorflow/cc/saved_model/reader.cc:54] Reading meta graph with tags { serve }
2021-03-21 18:12:48.079446: I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2
2021-03-21 18:12:48.110611: I tensorflow/cc/saved_model/loader.cc:202] Restoring SavedModel bundle.
2021-03-21 18:12:48.294807: I tensorflow/cc/saved_model/loader.cc:151] Running initialization op on SavedModel bundle at path: CreateModelWithPythonTensorflow/model
2021-03-21 18:12:48.316435: I tensorflow/cc/saved_model/loader.cc:311] SavedModel load for tags { serve }; Status: success. Took 534069 microseconds.
predicting...
Exception in thread "main" java.lang.IllegalArgumentException: DataType 20 is not recognized in Java (version 1.15.0)
at org.tensorflow.DataType.fromC(DataType.java:85)
at org.tensorflow.Tensor.fromHandle(Tensor.java:540)
at org.tensorflow.Session$Runner.runHelper(Session.java:343)
at org.tensorflow.Session$Runner.run(Session.java:276)
at TfDataTypeIssue.main(TfDataTypeIssue.java:43)`
The full code can be found on similar issues (#41212 (tensorflow/tensorflow#41212) or #1079 (xamarin/XamarinComponents#1079) or in this file ReportProblem.zip
. I used to get a trained model in Python in CreateModelWithPythonTensorflow and Java Maven Project when run gives the above error.
The text was updated successfully, but these errors were encountered: