Coder Social home page Coder Social logo

clarkmcc / tensorflow-inference-go Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 761 KB

Running TensorFlow model inference in pure Go using Rust WebAssembly

Home Page: https://www.clarkmccauley.com/blog/tensorflow-rust-go-an-unholy-union

Makefile 1.34% Jupyter Notebook 46.50% Rust 44.26% Go 7.89%

tensorflow-inference-go's Introduction

Running TensorFlow Models Natively in Go

This project is an example of building and training a Tensorflow model, manually porting it to Rust using candle, compiling the Rust to WebAssembly, and running the WebAssembly module from Go using Scale.

The following files are included:

Running the Example

$ go run main.go
Successfully classified the digit 0 in 1.357ms
Successfully classified the digit 1 in 618.541µs
Successfully classified the digit 2 in 607.417µs
Successfully classified the digit 3 in 636.5µs
Successfully classified the digit 4 in 622.291µs
Successfully classified the digit 5 in 638.375µs
Successfully classified the digit 6 in 666.25µs
Successfully classified the digit 7 in 647.791µs
Successfully classified the digit 8 in 614.666µs
Successfully classified the digit 9 in 608.333µs

Developing

Make sure you have Scale installed.

$ curl -fsSL https://dl.scale.sh | sh

Any changes to the Rust code, or the signature need to be re-compiled to WebAssembly. Run the following to re-generate all the signatures and compile the Rust code to WebAssembly.

$ make generate

tensorflow-inference-go's People

Contributors

clarkmcc avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.