Skip to content

Rust API #388

Description

@adamcrume

TensorFlow should have a Rust interface.

Original e-mail:
I'd like to write Rust bindings for TensorFlow, and I had a few questions. First of all, is anyone already working on this, and if so, can I lend a hand? If not, is this something the TensorFlow team would be interested in? I assume that the TensorFlow team would not be willing to commit right now to supporting Rust, so I thought a separate open source project (with the option to fold into the main project later) would be the way to go.

Activity

  1. girving commented on Dec 1, 2015

    @girving
    Contributor

    Moving email discussion here:

    Rust bindings would be cool! I don't think there's anyone working on rust bindings so far, though it might be worth an email to [email protected] to check. Agreed that a separate project is probably good to start out.

    To start the conversation, there are a couple different levels of bindings:

    1. Bindings that do not know about specific ops, but can create graphs "manually" or load them from GraphDefs, evaluate graphs (so that tensorflow models can be run inside rust servers), etc. There's hopefully nothing blocking that.
    2. Autogenerated bindings for each C++ op. We do this for Python, and similar things should work for Rust (ideally with a lot more type safety). I have limited intuition for rust's handling of ad-hoc polymorphism, so I can't judge how easy it'll be to fit tensorflow's notions of polymorphism into rust's. Again, there's hopefully nothing blocking this.
    3. Idiomatic bindings. We currently have a lot of logic in pure Python, including both per-op sugar and key features such as automatic differentiation. We will likely eventually move this to C++, but until then it will be difficult to capture this functionality in rust bindings without duplicating a ton of effort. Unfortunately, automatic differentiation in particular is (mostly) necessary if you want to train models.

    It's probably best to shoot for (1) to start and only move to (2) once it's clear how much of (3) will be a blocker for the desired applications.

  2. ajtulloch commented on Dec 4, 2015

    @ajtulloch

    FWIW, getting something like 1) is pretty straightforward with rust-bindgen and tensor_c_api.h, I put something together the other weekend in https://github.com/ajtulloch/tensorflow-rs/blob/master/src/tf.rs if that's useful.

  3. thomasquintana commented on Jan 27, 2016

    @thomasquintana

    I would be glad to work on a Rust interface for TensorFlow if nobody is currently working on a solution.

  4. adamcrume commented on Feb 5, 2016

    @adamcrume
    ContributorAuthor

    I just launched a project to provide the Rust bindings at https://github.com/google/tensorflow-rust. The build glue is there, but most of the bindings have yet to be written.

  5. girving commented on Feb 5, 2016

    @girving
    Contributor

    Nice! I'm happy to help with any issues you run into.

  6. jendap commented on Feb 5, 2016

    @jendap
    Contributor

    Cool!

  7. asimshankar commented on Oct 7, 2016

    @asimshankar
    Contributor

    It seems that the Rust bindings are building on top of c_api.h using the approach outlined in the how-to, which is great.

    If you run into concerns with the documentation or the C-API, please do create a separate issue

    Thanks!

  8. jhseu commented on Nov 4, 2016

    @jhseu
    Contributor

    Closing this issue. The Rust bindings have been moved to github.com/tensorflow/rust

  9. added a commit that references this issue on Jan 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions