Name | Date | Size | #Lines | LOC | ||
---|---|---|---|---|---|---|
.. | - | - | ||||
genop/ | 03-May-2024 | - | 1,442 | 1,070 | ||
op/ | 03-May-2024 | - | 40,088 | 19,202 | ||
BUILD | D | 03-May-2024 | 782 | 36 | 30 | |
README.md | D | 03-May-2024 | 3.2 KiB | 102 | 69 | |
android.go | D | 03-May-2024 | 715 | 21 | 2 | |
attrs.go | D | 03-May-2024 | 6.9 KiB | 247 | 195 | |
attrs_test.go | D | 03-May-2024 | 4 KiB | 194 | 129 | |
context.go | D | 03-May-2024 | 3 KiB | 110 | 62 | |
context_test.go | D | 03-May-2024 | 1.3 KiB | 58 | 38 | |
doc.go | D | 03-May-2024 | 1 KiB | 27 | 1 | |
example_inception_inference_test.go | D | 03-May-2024 | 9 KiB | 292 | 196 | |
graph.go | D | 03-May-2024 | 13.2 KiB | 475 | 320 | |
graph_test.go | D | 03-May-2024 | 7.5 KiB | 341 | 292 | |
lib.go | D | 03-May-2024 | 688 | 22 | 2 | |
operation.go | D | 03-May-2024 | 6.3 KiB | 217 | 118 | |
operation_test.go | D | 03-May-2024 | 6.2 KiB | 270 | 223 | |
saved_model.go | D | 03-May-2024 | 2.4 KiB | 75 | 35 | |
saved_model_test.go | D | 03-May-2024 | 1 KiB | 32 | 11 | |
session.go | D | 03-May-2024 | 11.8 KiB | 409 | 267 | |
session_test.go | D | 03-May-2024 | 7.9 KiB | 320 | 244 | |
shape.go | D | 03-May-2024 | 2.5 KiB | 105 | 59 | |
shape_test.go | D | 03-May-2024 | 2.1 KiB | 86 | 64 | |
status.go | D | 03-May-2024 | 1.7 KiB | 68 | 31 | |
tensor.go | D | 03-May-2024 | 16 KiB | 506 | 383 | |
tensor_handle.go | D | 03-May-2024 | 5.6 KiB | 171 | 85 | |
tensor_handle_test.go | D | 03-May-2024 | 2.8 KiB | 128 | 99 | |
tensor_test.go | D | 03-May-2024 | 8.3 KiB | 315 | 260 | |
test.sh | D | 03-May-2024 | 2.3 KiB | 76 | 40 | |
util_test.go | D | 03-May-2024 | 1.6 KiB | 66 | 45 | |
version.go | D | 03-May-2024 | 834 | 26 | 3 |
README.md
1# TensorFlow in Go 2 3Construct and execute TensorFlow graphs in Go. 4 5[](https://godoc.org/github.com/tensorflow/tensorflow/tensorflow/go) 6 7> *WARNING*: The API defined in this package is not stable and can change 8> without notice. The same goes for the package path: 9> (`github.com/tensorflow/tensorflow/tensorflow/go`). 10 11## Quickstart 12 13Refer to [Installing TensorFlow for Go](https://www.tensorflow.org/install/lang_go) 14 15## Building the TensorFlow C library from source 16 17If the "Quickstart" instructions above do not work (perhaps the release archives 18are not available for your operating system or architecture, or you're using a 19different version of CUDA/cuDNN), then the TensorFlow C library must be built 20from source. 21 22### Prerequisites 23 24- [bazel](https://www.bazel.build/versions/master/docs/install.html) 25- Environment to build TensorFlow from source code 26 ([Linux or macOS](https://www.tensorflow.org/install/source)). If you don't 27 need GPU support, then try the following: 28 29 ```sh 30 sudo apt-get install python swig python-numpy # Linux 31 brew install swig # OS X with homebrew 32 ``` 33 34### Build 35 361. Download the source code 37 38 ```sh 39 go get -d github.com/tensorflow/tensorflow/tensorflow/go 40 ``` 41 422. Build the TensorFlow C library: 43 44 ```sh 45 cd ${GOPATH}/src/github.com/tensorflow/tensorflow 46 ./configure 47 bazel build -c opt //tensorflow:libtensorflow.so 48 ``` 49 50 This can take a while (tens of minutes, more if also building for GPU). 51 523. Make `libtensorflow.so` and `libtensorflow_framework.so` available to the 53 linker. This can be done by either: 54 55 a. Copying it to a system location, e.g., 56 57 ```sh 58 sudo cp ${GOPATH}/src/github.com/tensorflow/tensorflow/bazel-bin/tensorflow/libtensorflow.so /usr/local/lib 59 sudo cp ${GOPATH}/src/github.com/tensorflow/tensorflow/bazel-bin/tensorflow/libtensorflow_framework.so /usr/local/lib 60 ``` 61 62 OR 63 64 b. Setting environment variables: 65 66 ```sh 67 export LIBRARY_PATH=${GOPATH}/src/github.com/tensorflow/tensorflow/bazel-bin/tensorflow 68 # Linux 69 export LD_LIBRARY_PATH=${GOPATH}/src/github.com/tensorflow/tensorflow/bazel-bin/tensorflow 70 # OS X 71 export DYLD_LIBRARY_PATH=${GOPATH}/src/github.com/tensorflow/tensorflow/bazel-bin/tensorflow 72 ``` 73 744. Build and test: 75 76 ```sh 77 go test github.com/tensorflow/tensorflow/tensorflow/go 78 ``` 79 80### Generate wrapper functions for ops 81 82Go functions corresponding to TensorFlow operations are generated in `op/wrappers.go`. To regenerate them: 83 84Prerequisites: 85- [Protocol buffer compiler (protoc) 3.x](https://github.com/google/protobuf/releases/) 86- The TensorFlow repository under GOPATH 87 88```sh 89go generate github.com/tensorflow/tensorflow/tensorflow/go/op 90``` 91 92## Support 93 94Use [stackoverflow](http://stackoverflow.com/questions/tagged/tensorflow) and/or 95[Github issues](https://github.com/tensorflow/tensorflow/issues). 96 97## Contributions 98 99Contributions are welcome. If making any signification changes, probably best to 100discuss on a [Github issue](https://github.com/tensorflow/tensorflow/issues) 101before investing too much time. Github pull requests are used for contributions. 102