Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/wamuir/graft
Go language bindings to the TensorFlow C API
https://github.com/wamuir/graft
go golang machine-learning tensorflow
Last synced: about 2 months ago
JSON representation
Go language bindings to the TensorFlow C API
- Host: GitHub
- URL: https://github.com/wamuir/graft
- Owner: wamuir
- License: apache-2.0
- Created: 2021-12-11T10:47:50.000Z (about 3 years ago)
- Default Branch: nightly
- Last Pushed: 2024-09-19T18:15:39.000Z (4 months ago)
- Last Synced: 2024-09-28T10:06:46.285Z (3 months ago)
- Topics: go, golang, machine-learning, tensorflow
- Language: Go
- Homepage: https://pkg.go.dev/github.com/wamuir/graft
- Size: 4.21 MB
- Stars: 44
- Watchers: 3
- Forks: 3
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Graft
[![tensorflow version](https://img.shields.io/badge/tf-nightly-FF6F00?logo=tensorflow&logoColor=FF6F00)](https://github.com/tensorflow/tensorflow/tree/nightly)
[![nightly](https://img.shields.io/github/actions/workflow/status/wamuir/graft/integrate-nightly-changes.yml?branch=nightly&label=nightly%20ci&logo=github&event=schedule)](https://github.com/wamuir/graft/actions/workflows/integrate-nightly-changes.yml?query=branch%3Anightly)
[![go.dev reference](https://pkg.go.dev/badge/wamuir/graft)](https://pkg.go.dev/github.com/wamuir/graft/tensorflow)## About
**Go language bindings to the TensorFlow C API**
Graft contains nightly and release builds of the Go language bindings to the
TensorFlow C API, including Go-compiled TensorFlow protocol buffers and
generated Go wrappers for TensorFlow operations.Use Graft exactly as you would use the Go bindings found in the main TensorFlow
repo, and with the following import statement: `github.com/wamuir/graft/tensorflow`## Getting Started
> Note: the Go bindings depend on
> [libtensorflow](https://www.tensorflow.org/install/lang_c), which should be
> downloaded (or compiled) and installed first.Installation is performed using `go get`:
```sh
go get -u github.com/wamuir/graft/tensorflow/...
```Hello TensorFlow
```go
package mainimport (
tf "github.com/wamuir/graft/tensorflow"
"github.com/wamuir/graft/tensorflow/op"
"fmt"
)func main() {
// Construct a graph with an operation that produces a string constant.
s := op.NewScope()
c := op.Const(s, "Hello from TensorFlow version " + tf.Version())
graph, err := s.Finalize()
if err != nil {
panic(err)
}// Execute the graph in a session.
sess, err := tf.NewSession(graph, nil)
if err != nil {
panic(err)
}
output, err := sess.Run(nil, []tf.Output{c}, nil)
if err != nil {
panic(err)
}
fmt.Println(output[0].Value())
}
```## Credits
Graft is a compilation of [TensorFlow](https://tensorflow.org/code) source
code.