-
Notifications
You must be signed in to change notification settings - Fork 214
Static methods in interface require -target:jvm-1.8 #265
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
Infact I don't know what ${javacpp.platform.extension} is, and haven't add this:
Instead, I delete ${javacpp.platform.extension} like this:
|
Looks like that's a Scala issue not a TF-Java issue, you need to tell the Scala compiler to use the appropriate JVM backend - https://stackoverflow.com/questions/49213620/static-methods-in-interface-require-targetjvm-1-8. If you use the core api jar without a specifier then it will use CPUs to execute all the code. This is fine assuming that's what you want. Otherwise you can supply one of "-mkl", "-gpu" and "-mkl-gpu" to have Intel's oneDNN support, CUDA GPU support or both. |
thanks, but my scala(spark) project works well for 2 years without using TF-Java 0.3.1. And work well with the old version ( TensorFlow1.14). when I use the old version, I can create tensor like 'Tensor.create(Array(0.000231F,0.008493F))' correctly.
I will try a new scala project after that. |
If your Scala project wasn't calling any default methods on Java interfaces then it wouldn't have triggered the issue. We use them extensively in TF-Java, and they've been part of Java since Java 8 was released in 2014. It looks like it found the mkl dependency, as it managed to resolve some of its dependencies. Does Maven give you an error message when building? |
I update the last reply just now. when I try to build the project, the error message is the same:
And I can build my project correctly without try to create tensor. I tried a new project, but facing the same error. |
First, I trainned my model with TF2.4.0.
Third, I tried to use the PB model in my scala project with old dependencies( TF1.15 ), but failed:
last, I tried to use the PB model in my scala project with new dependencies( TF-Java 0.3.1 ), but failed to create any tensor. |
Yes, but the issue is due to your scala build, not a problem in TF-Java. The 1.x version didn't use default methods as heavily, so you didn't hit the issue. The new one does, so you need to make sure that your Scala compiler is happy with using 7 year old language features from Java 8. |
I wouldn't expect TF 1.x to be able to load a TF 2 model so that's not too surprising. |
yes, I mean this error message only appears while I try to create tensor by using TF-Java 0.3+
I add '-target:jvm-1.8' to my setting just now: and the error message changed, I can't load my model and create tensor now:
So, I followed this way #259
Everything's all right now! Thank you very much! |
By the way, I tried to add '-target:jvm-1.8' to my pom.xml first, but it do not work.
So I change my IDEA setting instead. |
I can't create any tensor, the error message is:
Error:(141, 52) Static methods in interface require -target:jvm-1.8
val fed2 = TInt32.tensorOf( org.tensorflow.ndarray.NdArrays.vectorOf(4, 3, 2, 1) )
Error:(142, 51) Static methods in interface require -target:jvm-1.8
val fed = TInt32.tensorOf(Shape.of(4)).setInt(4, 0).setInt(3, 1).setInt(2, 2).setInt(1, 3)
Error:(149, 37) Static methods in interface require -target:jvm-1.8
val itemId_index=TInt32.vectorOf(6135)
........
my scala code for test is:
the version is:
my environment:
Windows10 64bit,
idea 2018.3.5,
jdk1.8
Thank you!
The text was updated successfully, but these errors were encountered: