Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
T
tf-build
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Benedikt Wildenhain
tf-build
Commits
e4b69a88
Unverified
Commit
e4b69a88
authored
Jul 6, 2023
by
William Muir
Committed by
GitHub
Jul 6, 2023
Browse files
Options
Downloads
Patches
Plain Diff
[Go] Update Go API installation guide for TensorFlow 2.13.0 (#153)
parent
01b5f632
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
golang_install_guide/README.md
+9
-8
9 additions, 8 deletions
golang_install_guide/README.md
golang_install_guide/example-program/Dockerfile
+7
-6
7 additions, 6 deletions
golang_install_guide/example-program/Dockerfile
with
16 additions
and
14 deletions
golang_install_guide/README.md
+
9
−
8
View file @
e4b69a88
...
@@ -48,8 +48,8 @@ repo, and with one of the following import statements:
...
@@ -48,8 +48,8 @@ repo, and with one of the following import statements:
| TensorFlow C API | Graft |
| TensorFlow C API | Graft |
| :------------------------ | :-------------------------------------------------------------------------------------------------- |
| :------------------------ | :-------------------------------------------------------------------------------------------------- |
| TensorFlow Release 2.1
2
.0 |
[
`go get github.com/wamuir/graft/tensorflow@v0.
4
.0`
](
https://github.com/wamuir/graft/tree/v0.
4
.0
)
|
| TensorFlow Release 2.1
3
.0 |
[
`go get github.com/wamuir/graft/tensorflow@v0.
5
.0`
](
https://github.com/wamuir/graft/tree/v0.
5
.0
)
|
| TensorFlow Release 2.1
1
.1 |
[
`go get github.com/wamuir/graft/tensorflow@v0.
3
.1`
](
https://github.com/wamuir/graft/tree/v0.
3
.1
)
|
| TensorFlow Release 2.1
2
.1 |
[
`go get github.com/wamuir/graft/tensorflow@v0.
4
.1`
](
https://github.com/wamuir/graft/tree/v0.
4
.1
)
|
| TensorFlow Nightly |
[
`go get github.com/wamuir/graft/tensorflow@nightly`
](
https://github.com/wamuir/graft/tree/nightly
)
|
| TensorFlow Nightly |
[
`go get github.com/wamuir/graft/tensorflow@nightly`
](
https://github.com/wamuir/graft/tree/nightly
)
|
...
@@ -58,7 +58,7 @@ repo, and with one of the following import statements:
...
@@ -58,7 +58,7 @@ repo, and with one of the following import statements:
<details>
<details>
<summary>
Click to expand
</summary>
<summary>
Click to expand
</summary>
> Note: these build instructions are specific to TensorFlow 2.1
2
.0
> Note: these build instructions are specific to TensorFlow 2.1
3
.0
### 1. Install the TensorFlow C Library
### 1. Install the TensorFlow C Library
...
@@ -67,7 +67,7 @@ library is required for use of the TensorFlow Go package at runtime. For example
...
@@ -67,7 +67,7 @@ library is required for use of the TensorFlow Go package at runtime. For example
on Linux (64-bit, x86):
on Linux (64-bit, x86):
```
sh
```
sh
$
curl
-L
https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-linux-x86_64-2.1
2
.0.tar.gz |
tar
xz
--directory
/usr/local
$
curl
-L
https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-linux-x86_64-2.1
3
.0.tar.gz |
tar
xz
--directory
/usr/local
$
ldconfig
$
ldconfig
```
```
...
@@ -105,7 +105,7 @@ Instead, follow these instructions.***
...
@@ -105,7 +105,7 @@ Instead, follow these instructions.***
workspace for
`/go`
in the command below.
workspace for
`/go`
in the command below.
```
sh
```
sh
$
git clone
--branch
v2.1
2
.0 https://github.com/tensorflow/tensorflow.git /go/src/github.com/tensorflow/tensorflow
$
git clone
--branch
v2.1
3
.0 https://github.com/tensorflow/tensorflow.git /go/src/github.com/tensorflow/tensorflow
```
```
-
Change the working directory to the base of the cloned TensorFlow repository,
-
Change the working directory to the base of the cloned TensorFlow repository,
...
@@ -126,8 +126,9 @@ Instead, follow these instructions.***
...
@@ -126,8 +126,9 @@ Instead, follow these instructions.***
```
sh
```
sh
$
sed
-i
'4 i option go_package = "github.com\/tensorflow\/tensorflow\/tensorflow\/go\/core\/framework\/dataset_go_proto";'
tensorflow/core/framework/dataset.proto
$
sed
-i
'4 i option go_package = "github.com\/tensorflow\/tensorflow\/tensorflow\/go\/core\/framework\/dataset_go_proto";'
tensorflow/core/framework/dataset.proto
$
sed
-i
'9 c option go_package = "github.com\/tensorflow\/tensorflow\/tensorflow\/go\/core\/framework\/graph_debug_info_go_proto";'
tensorflow/core/framework/graph_debug_info.proto
$
sed
-i
'4 i option go_package = "github.com\/tensorflow\/tensorflow\/tensorflow\/go\/core\/framework\/optimized_function_graph_go_proto";'
tensorflow/core/framework/optimized_function_graph.proto
$
sed
-i
'4 i option go_package = "github.com\/tensorflow\/tensorflow\/tensorflow\/go\/core\/framework\/optimized_function_graph_go_proto";'
tensorflow/core/framework/optimized_function_graph.proto
$
sed
-i
'4 i option go_package = "github.com\/google\/tsl\/tsl\/go\/core\/protobuf\/for_core_protos_go_proto";
;
'
tensorflow/tsl/protobuf/test_log.proto
$
sed
-i
'4 i option go_package = "github.com\/google\/tsl\/tsl\/go\/core\/protobuf\/for_core_protos_go_proto";'
tensorflow/tsl/protobuf/test_log.proto
```
```
-
Patch tensorflow/go/genop to generate TF and TSL protobufs.
-
Patch tensorflow/go/genop to generate TF and TSL protobufs.
...
@@ -182,7 +183,7 @@ workspace for `/go` in the command below:
...
@@ -182,7 +183,7 @@ workspace for `/go` in the command below:
```
sh
```
sh
$
go mod init hello-world
$
go mod init hello-world
$
go mod edit
-require
github.com/google/tsl@v0.0.0+incompatible
$
go mod edit
-require
github.com/google/tsl@v0.0.0+incompatible
$
go mod edit
-require
github.com/tensorflow/tensorflow@v2.1
2
.0+incompatible
$
go mod edit
-require
github.com/tensorflow/tensorflow@v2.1
3
.0+incompatible
$
go mod edit
-replace
github.com/google/tsl
=
/go/src/github.com/google/tsl
$
go mod edit
-replace
github.com/google/tsl
=
/go/src/github.com/google/tsl
$
go mod edit
-replace
github.com/tensorflow/tensorflow
=
/go/src/github.com/tensorflow/tensorflow
$
go mod edit
-replace
github.com/tensorflow/tensorflow
=
/go/src/github.com/tensorflow/tensorflow
$
go mod tidy
$
go mod tidy
...
@@ -230,7 +231,7 @@ func main() {
...
@@ -230,7 +231,7 @@ func main() {
```
sh
```
sh
$
go mod init app
$
go mod init app
$
go mod edit
-require
github.com/google/tsl@v0.0.0+incompatible
$
go mod edit
-require
github.com/google/tsl@v0.0.0+incompatible
$
go mod edit
-require
github.com/tensorflow/tensorflow@v2.1
2
.0+incompatible
$
go mod edit
-require
github.com/tensorflow/tensorflow@v2.1
3
.0+incompatible
$
go mod edit
-replace
github.com/google/tsl
=
/go/src/github.com/google/tsl
$
go mod edit
-replace
github.com/google/tsl
=
/go/src/github.com/google/tsl
$
go mod edit
-replace
github.com/tensorflow/tensorflow
=
/go/src/github.com/tensorflow/tensorflow
$
go mod edit
-replace
github.com/tensorflow/tensorflow
=
/go/src/github.com/tensorflow/tensorflow
$
go mod tidy
$
go mod tidy
...
...
This diff is collapsed.
Click to expand it.
golang_install_guide/example-program/Dockerfile
+
7
−
6
View file @
e4b69a88
...
@@ -14,10 +14,10 @@
...
@@ -14,10 +14,10 @@
# ============================================================================
# ============================================================================
FROM
golang:1.20-b
ullseye
FROM
golang:1.20-b
ookworm
# 1. Install the TensorFlow C Library (v2.1
2
.0).
# 1. Install the TensorFlow C Library (v2.1
3
.0).
RUN
curl
-L
https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-linux-
$(
uname
-m
)
-2
.1
2
.0.tar.gz
\
RUN
curl
-L
https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-linux-
$(
uname
-m
)
-2
.1
3
.0.tar.gz
\
|
tar
xz
--directory
/usr/local
\
|
tar
xz
--directory
/usr/local
\
&&
ldconfig
&&
ldconfig
...
@@ -27,12 +27,13 @@ RUN apt-get update && apt-get -y install --no-install-recommends \
...
@@ -27,12 +27,13 @@ RUN apt-get update && apt-get -y install --no-install-recommends \
protobuf-compiler
protobuf-compiler
# 3. Install and Setup the TensorFlow Go API.
# 3. Install and Setup the TensorFlow Go API.
RUN
git clone
--branch
=
v2.1
2
.0 https://github.com/tensorflow/tensorflow.git /go/src/github.com/tensorflow/tensorflow
\
RUN
git clone
--branch
=
v2.1
3
.0 https://github.com/tensorflow/tensorflow.git /go/src/github.com/tensorflow/tensorflow
\
&&
cd
/go/src/github.com/tensorflow/tensorflow
\
&&
cd
/go/src/github.com/tensorflow/tensorflow
\
&&
go mod init github.com/tensorflow/tensorflow
\
&&
go mod init github.com/tensorflow/tensorflow
\
&&
sed
-i
'4 i option go_package = "github.com\/tensorflow\/tensorflow\/tensorflow\/go\/core\/framework\/dataset_go_proto";'
tensorflow/core/framework/dataset.proto
\
&&
sed
-i
'4 i option go_package = "github.com\/tensorflow\/tensorflow\/tensorflow\/go\/core\/framework\/dataset_go_proto";'
tensorflow/core/framework/dataset.proto
\
&&
sed
-i
'9 c option go_package = "github.com\/tensorflow\/tensorflow\/tensorflow\/go\/core\/framework\/graph_debug_info_go_proto";'
tensorflow/core/framework/graph_debug_info.proto
\
&&
sed
-i
'4 i option go_package = "github.com\/tensorflow\/tensorflow\/tensorflow\/go\/core\/framework\/optimized_function_graph_go_proto";'
tensorflow/core/framework/optimized_function_graph.proto
\
&&
sed
-i
'4 i option go_package = "github.com\/tensorflow\/tensorflow\/tensorflow\/go\/core\/framework\/optimized_function_graph_go_proto";'
tensorflow/core/framework/optimized_function_graph.proto
\
&&
sed
-i
'4 i option go_package = "github.com\/google\/tsl\/tsl\/go\/core\/protobuf\/for_core_protos_go_proto";
;
'
tensorflow/tsl/protobuf/test_log.proto
\
&&
sed
-i
'4 i option go_package = "github.com\/google\/tsl\/tsl\/go\/core\/protobuf\/for_core_protos_go_proto";'
tensorflow/tsl/protobuf/test_log.proto
\
&&
sed
-i
'71d;72d'
tensorflow/go/genop/generate.sh
\
&&
sed
-i
'71d;72d'
tensorflow/go/genop/generate.sh
\
&&
sed
-i
'71 i \ ${TF_DIR}\/tensorflow\/tsl\/protobuf\/*.proto \\'
tensorflow/go/genop/generate.sh
\
&&
sed
-i
'71 i \ ${TF_DIR}\/tensorflow\/tsl\/protobuf\/*.proto \\'
tensorflow/go/genop/generate.sh
\
&&
sed
-i
'72 i \ ${TF_DIR}\/tensorflow\/compiler\/xla\/stream_executor\/dnn.proto; do'
tensorflow/go/genop/generate.sh
\
&&
sed
-i
'72 i \ ${TF_DIR}\/tensorflow\/compiler\/xla\/stream_executor\/dnn.proto; do'
tensorflow/go/genop/generate.sh
\
...
@@ -48,7 +49,7 @@ WORKDIR /example-program
...
@@ -48,7 +49,7 @@ WORKDIR /example-program
COPY
hello_tf.go .
COPY
hello_tf.go .
RUN
go mod init app
\
RUN
go mod init app
\
&&
go mod edit
-require
github.com/google/tsl@v0.0.0+incompatible
\
&&
go mod edit
-require
github.com/google/tsl@v0.0.0+incompatible
\
&&
go mod edit
-require
github.com/tensorflow/tensorflow@v2.1
2
.0+incompatible
\
&&
go mod edit
-require
github.com/tensorflow/tensorflow@v2.1
3
.0+incompatible
\
&&
go mod edit
-replace
github.com/google/tsl
=
/go/src/github.com/google/tsl
\
&&
go mod edit
-replace
github.com/google/tsl
=
/go/src/github.com/google/tsl
\
&&
go mod edit
-replace
github.com/tensorflow/tensorflow
=
/go/src/github.com/tensorflow/tensorflow
\
&&
go mod edit
-replace
github.com/tensorflow/tensorflow
=
/go/src/github.com/tensorflow/tensorflow
\
&&
go mod tidy
\
&&
go mod tidy
\
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment