<p>Anyone have experience using tensorflow in go? Is it still being worked on? I would hate to have to resort to using Python...</p>
<hr/>**评论:**<br/><br/>pgaleone: <pre><p>Yes, I'm working with go + tensorflow.</p>
<p>The Go APIs are just bindings for the C++ API: you have to manually define the graph, deal with the scopes (that without the context managers of python it's a pain) and differently from the C++ API the type system is a complete mess.</p>
<p>Since every method accepts a tf.Output type as input and the tf.Output has it's Tensorflow type, you have to correctly define the tf.Output structure with the right (and thus implemented) type.
You have no compile time check and thus if you, for instance, pass a int64 instead of an int32 when you create a parameter and the function you're using has no a registered kernel for the int64, your program will compile but when you execute the graph within a session you'll get a segfault and debugging is extremely hard.</p>
<p>Moreover you don't have the Variable (that's a Python class) and thus you can't train model (no tensorboard support, ecc...).
The Go API (and the C++ API too) it's extremely good to load a model defined and trained using python and use it in a production env.</p>
<p>If you want to define and train models: use python.
If you want to use trained models or use the Go bindings to execute simple operations within the tensorflow environment (for instance execute a RGB to HSV conversion) you can use Go (but keep in mind that's hard to define and debug because of lack of the compile time support)</p></pre>loganjspears: <pre><p>That's interesting. For my use case I don't care where I train, but would like to use go for predictions. Thank you for sharing your experience. </p>
<p>Also do you think Go will ever get first class support?</p></pre>pgaleone: <pre><p>I see very few updates in the repo folder dedicated to go ( <a href="https://github.com/tensorflow/tensorflow/commits/master/tensorflow/go" rel="nofollow">https://github.com/tensorflow/tensorflow/commits/master/tensorflow/go</a> ): the great majority of the commits are just the updates of the generated wrappers (commits made by a bot, really).</p>
<p>Thus I guess that's something the tensorflow developers are not very interested in, they just maintain this automatic wrapper and focus their efforts on the C++ (and python) API.</p>
<p>However, I'm writing a wrapper around the Go API (something like an additional abstraction layer that hides the complexity of scopes management and type issues): this won't add the support for training or any higher level application (that's python for this), but it can be used to build computational graphs and executes operation into GPUs and then use the results directly in Go (in reality I'm building an image processing library around the tensorflow Go bindings, but the same approach can be used to build a general tensor-processing library and use it like we do in python)</p></pre>chewxy: <pre><p>Self promotion here - if you want to use a Go equivalent, there is <a href="https://github.com/chewxy/gorgonia">gorgonia</a></p>
<p>There will be a few API breakings (3 last I checked) in the coming weeks though.</p></pre>loganjspears: <pre><p>Checked it out and it looks like a serious alternative. Thanks for sharing.</p></pre>chewxy: <pre><p>And it did dynamic graphs out of the box too (in the coming weeks it'll be CUDA accelerated too!)</p></pre>Damien0: <pre><p>Yes, there is an official Go API: <a href="https://godoc.org/github.com/tensorflow/tensorflow/tensorflow/go" rel="nofollow">https://godoc.org/github.com/tensorflow/tensorflow/tensorflow/go</a></p></pre>loganjspears: <pre><p>Thanks! I found getting started info here: <a href="https://github.com/tensorflow/tensorflow/blob/master/tensorflow/go/README.md">https://github.com/tensorflow/tensorflow/blob/master/tensorflow/go/README.md</a> </p>
<p>Also there is a short example in the repo. Looks like the API is not stable tho :(</p></pre>
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889
- 请尽量让自己的回复能够对别人有帮助
- 支持 Markdown 格式, **粗体**、~~删除线~~、
`单行代码`
- 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
- 图片支持拖拽、截图粘贴等方式上传