tensorflow / decision-forests

A collection of state-of-the-art algorithms for the training, serving and interpretation of Decision Forest models in Keras.
Apache License 2.0
663 stars 110 forks source link

Custom ops are incompatible with Tensorflow Java SDK #101

Closed mattdornfeld closed 2 years ago

mattdornfeld commented 2 years ago

Hello! I'm working on serving a tfdf model with the Java SDK. I tried the solution describe here, where you pass the compiled .so file for the tf-df library to TensorFlow.loadLibrary before calling SavedModelBundle.load. I ran into this exception

        Caused by:
        org.tensorflow.exceptions.TFInvalidArgumentException: No shape inference function exists for op 'SimpleMLLoadModelFromPathWithHandle', did you forget to define it?
            at org.tensorflow.internal.c_api.AbstractTF_Status.throwExceptionIfNotOK(AbstractTF_Status.java:87)
            at org.tensorflow.SavedModelBundle.load(SavedModelBundle.java:623)
            at org.tensorflow.SavedModelBundle.access$000(SavedModelBundle.java:67)
            at org.tensorflow.SavedModelBundle$Loader.load(SavedModelBundle.java:97)
            at org.tensorflow.SavedModelBundle.load(SavedModelBundle.java:357)

I asked around the tensorflow/Java Github here and they're conclusion seems to be there's an issue with the custom ops defined as part of this library in that they don't implement the SetShapeFn. Any idea on how much work it would be to fix this compatibility issue?

achoum commented 2 years ago

Following-up in the TensorFlow issue.

achoum commented 2 years ago

TF-DF ops are now compatible with TF Java. See this issue for more details.