-
Notifications
You must be signed in to change notification settings - Fork 0
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
Research passing Scala functions to TensorFlow Python APIs #23
Comments
The official Java bindings for TF seem to rely on DSL that de facto allows for constructing a restricted set of Python ASTs from Java code (see e.g. https://www.tensorflow.org/api_docs/java/reference/org/tensorflow/Operand) |
We can mimic this approach in our implementation as well; a more generic but also much more advanced approach for Scala 3 would be with quote/splice metaprogramming: https://dotty.epfl.ch/docs/reference/metaprogramming/macros.html |
This might provide the hint on how to do it with low-ish engineering overhead: https://github.com/ninia/jep/wiki/How-Jep-Works#objects
TBD exact mechanics and its limitations (e.g. note that in JEP Python interpreter instances are managed by JEP within the JVM). |
Also, Swift<->TF bindings might be interesting |
Ok @Gryfit could you drop a 1-2 sentence summary of what's possible/not possible in the mentioned Swift binding? |
JAVA:Awkward builders, that require creating operations from scratch. Operation ax = graph.opBuilder("Mul", "ax")
.addInput(a.output(0))
.addInput(x.output(0))
.build(); Quoting documentation:
SWIFT:As far as I understand the idea is to calculate loss function (one of those we would normally pass to Either way as suggested in this PR tensorflow/swift#211 a way to pass functions has not been implemented although there is a suggestion it could be done relatively easy tensorflow/swift#211 (comment). print(test.f(PythonObject({ z in pow(z, 2) }), 5)) It would however mean writing those function in python and then wrapping them into swift. JS:Also no support. ConclusionIn general even though the new |
See how Java bindings to Tensorflow addressed this problem (if they have at all)
The text was updated successfully, but these errors were encountered: