tfcgo

package module
v0.0.0-...-e77bd72 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 21, 2018 License: MIT Imports: 10 Imported by: 0

README

What is tfcgo?

tfcgo was born out of necessity. Tensorflow go bindings are slow to progress. Relying on protobufs to generate wrapper code is dependant on the growth of the c/c++ public api - and the underlying framework has much more to offer! This library will eventually do the hard work bridging the gap between go and the Tensorflow c++ framework. Training a TF machine learning algorithm is possible in go. Please note contributions in this repo will be submitted to the main tensorflow repo.

Docker Installation

Install Docker

Build your own image from source

git clone this repo: git clone https://github.com/ctava/tfcgo

Run the following commands:
cd tfcgo
docker build -t ctava/tfcgo .
To run with shared volume, you can add /go to shared paths from Docker -> Preferences... -> File Sharing.
docker run -v /go/src/github.com/ctava/tfcgo:/go/src/github.com/ctava/tfcgo -it -p 8888:8888 ctava/tfcgo:latest

and your in. You now have tensorflow + golang + tfcgo available.

Running from a prebuilt/publish docker image

Run the following commands:
docker pull ctava/tfcgo:latest
docker run -it --security-opt=seccomp:unconfined -p 8888:8888 ctava/tfcgo:latest

--security-opt for the purposes of using delve

and your in. You now have tensorflow + golang + tfcgo available.

Confirm Golang, Tensorflow and tfcgo installation

Run the following commands:
go run versioncheck.go

You should see the versions of golang, tensorflow and tfcgo as specified in the docker file.

Now for the fun stuff

go run listops.go

You should see a list of all of the ops available in tensorflow

Training

go run linear.go

Multi-Class Classification

go run iris.go (coming soon)

Additional resources

gopherdata

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Log

func Log(s *op.Scope, value interface{}) (*tf.Tensor, tf.Output, error)

Log - accepts a tensor of [][]float64 and squares []float64[0]

func MakeConst

func MakeConst(s *op.Scope, value interface{}) (tf.Output, error)

func MakeTensorAndOutput

func MakeTensorAndOutput(s *op.Scope, value interface{}) (*tf.Tensor, tf.Output, error)

func RandomSample

func RandomSample(t *tf.Tensor) (*tf.Tensor, error)

func ReduceMean

func ReduceMean(t *tf.Tensor) (*tf.Tensor, error)

ReduceMean - mean accross elements

func RegisteredOps

func RegisteredOps() (*pb.OpList, error)

RegisteredOps returns all of the supported TF c/c++ api

func SaySomething

func SaySomething(saying string) string

SaySomething

func Square

func Square(s *op.Scope, value interface{}) (*tf.Tensor, tf.Output, error)

Square - accepts a tensor of [][]float64 and squares []float64[0]

func SquareT

func SquareT(t *tf.Tensor) (*tf.Tensor, error)

Square - accepts a tensor of [][]float64 and squares []float64[0]

func SumOfSquares

func SumOfSquares(s *op.Scope, value interface{}) (*tf.Tensor, tf.Output, error)

SumOfSquares - accepts a value (expecting [][]float64) and returns sum of squares

func Variable

func Variable(scope *op.Scope, initialValue tf.Output) (init *tf.Operation, handle, value tf.Output)

Variable - this function creats a variable for training purposes.

Returns: the init operation - very important - this needs to be run in a session to be initialized a handle to the variable - for use in assignment operations an Output that produces the current value of the variable

func VariableAndTensor

func VariableAndTensor(scope *op.Scope, initialValue tf.Output, v interface{}) (t *tf.Tensor, init *tf.Operation, handle, value tf.Output)

Variable - this function creats a variable for training purposes.

Returns: the init operation - very important - this needs to be run in a session to be initialized a handle to the variable - for use in assignment operations an Output that produces the current value of the variable

func Version

func Version() float64

Version returns version for this library

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL