golang library

385 views
Skip to first unread message

Nathan Goulding

unread,
Dec 3, 2015, 5:23:18 PM12/3/15
to Discuss
There's been some interest expressed in building a TF library for Go: https://github.com/tensorflow/tensorflow/issues/10

Before embarking on this endeavor, I thought it'd be a good idea to get some feedback first. From http://www.tensorflow.org/api_docs/cc/index.html, it seems like maybe at some point in the future the public TF library may add the support for building graphs and not just executing them, but for now it's limited to executing graphs: "TensorFlow's public C++ API includes only the API for executing graphs, as of version 0.5."

It seems like the current recommended way is to use python to build the graph, then use tf.train.write_graph() to write the graph to a file, and then load it into a session into C++ (or insert your language of choice), and then run it using the TF C++ API.

It doesn't feel like it will be a trivial thing to port the graph building code from Python to Go, and arguably there are some things in there that would be error prone and would benefit from being abstracted away. So a few questions for those that may have more information than me:

- Are there plans to build and expose the graph building mechanism via the C++ API?
- Would a Go library in an ideal world have graph building itself, or simply be an interface to the C++ API as it could do for graph executing today?

Nathan

Geoffrey Irving

unread,
Dec 3, 2015, 5:39:03 PM12/3/15
to Nathan Goulding, Discuss
I wrote a few notes about different levels of binding here: https://github.com/tensorflow/tensorflow/issues/388.

--
You received this message because you are subscribed to the Google Groups "Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to discuss+u...@tensorflow.org.
To post to this group, send email to dis...@tensorflow.org.
To view this discussion on the web visit https://groups.google.com/a/tensorflow.org/d/msgid/discuss/8d972732-595e-4530-8c47-bbf6e79ae846%40tensorflow.org.

Alonso Vidales

unread,
Dec 3, 2015, 6:02:47 PM12/3/15
to Geoffrey Irving, Nathan Goulding, Discuss
Thanks for sharing. I agree with the idea of start with (1) and move to (2), but I’m not completely sure about the idea of move to (3) since Go doesn’t support operator overloading, etc, for me Python still seems like the best approach to prepare the graph.


Geoffrey Irving

unread,
Dec 3, 2015, 6:04:48 PM12/3/15
to Alonso Vidales, Nathan Goulding, Discuss
If you're generating the graphs in Python, all you really need is (1).

Nathan Goulding

unread,
Dec 3, 2015, 10:05:38 PM12/3/15
to Geoffrey Irving, Alonso Vidales, Discuss
This sounds like a good first step, although I suppose this would be limited to non-interactive sessions?

Alonso Vidales

unread,
Dec 4, 2015, 4:14:12 AM12/4/15
to Nathan Goulding, Geoffrey Irving, Discuss
Yes, the idea would be to build the graph, play with it, etc, using Python being able to export and execute it in Go. Let’s say that, instead of port the Python libs functionality, the most realistic approach would be to build a Go API to wrap the C++ API, so we can have the same functionality in Go that we have on the C++ API:
And, if in a future they port all the logic to prepare the graph to C++, we could have that functionality also, but in the meantime I think that it would be better try to avoid code duplication.
Reply all
Reply to author
Forward
0 new messages