/golang-tf

Working golang + tensorflow

Primary LanguageDockerfileMIT LicenseMIT

golang-tf

About

This repository contains Dockerfiles for using Tensorflow in Go. You can build on your own or pull an image from wamuir/golang-tf on Docker Hub:

docker pull wamuir/golang-tf

Usage with Go Modules

Go modules (go mod) will work when using the image. Use the require and replace flags as follows:

go mod edit -require github.com/tensorflow/tensorflow@v2.5.0+incompatible
go mod edit -replace github.com/tensorflow/tensorflow=/go/src/github.com/tensorflow/tensorflow

GPU Support

Installation of the NVIDIA Container Toolkit is necessary for GPU use. Then, expose the GPU(s) to the docker container using the --gpus all flag. Example:

docker run -it --rm --gpus all wamuir/golang-tf:2.5.0-gpu

Background

For background on the problem, see Tensorflow issues 39307, 39744, 41808, 43847, and 44655, among others.