Tensors and differentiable operations (like TensorFlow) in Rust

Overview

autograd

Build Status Crates.io version docs.rs

Differentiable operations and tensors backed by ndarray.

Motivation

Machine learning is one of the field where Rust lagging behind other languages. The aim of this crate is to show that Rust has the capability to implement efficient and full-featured dataflow graph naturally. Moreover, the core of this crate is quite small compared to others (due to being implemented in pure Rust and ndarray), therefore it might be reasonable for those who are not familiar with how this kind of library works.

Installation

[dependencies]
autograd = { version = "1.1.0", features = ["mkl"] }

mkl feature is recommended to speedup linalg operations using Intel MKL.

rustc version

Tested with rustc 1.38 ..= 1.42

Features

Lazy, lightweight tensor evaluation

Computation graphs are created on the fly (a.k.a. define-by-run), but are not evaluated until eval is called. This mechanism balances better performance and flexibility.

use autograd as ag;

ag::with(|g: &mut ag::Graph<_>| {
    let a: ag::Tensor<f32> = g.ones(&[60]);
    let b: ag::Tensor<f32> = g.ones(&[24]);
    let c: ag::Tensor<f32> = g.reshape(a, &[3, 4, 5]);
    let d: ag::Tensor<f32> = g.reshape(b, &[4, 3, 2]);
    let e: ag::Tensor<f32> = g.tensordot(c, d, &[1, 0], &[0, 1]);
    e.eval(&[]);  // Getting `ndarray::Array` here.
});

Reverse-mode automatic differentiation

There are a lot of built-in operations that support higher-order derivatives, and you can also define your own differentiable ops with ndarrays easily.

Here we are just computing partial derivatives of z = 2x^2 + 3y + 1.

ag::with(|g: &mut ag::Graph<_>| {
   let x = g.placeholder(&[]);
   let y = g.placeholder(&[]);
   let z = 2.*x*x + 3.*y + 1.;

   // dz/dy
   let gy = &g.grad(&[z], &[y])[0];
   println!("{:?}", gy.eval(&[]));   // => Ok(3.)

   // dz/dx (requires to fill the placeholder `x`)
   let gx = &g.grad(&[z], &[x])[0];
   let feed = ag::ndarray::arr0(2.);
   println!("{:?}", gx.eval(&[x.given(feed.view())]));  // => Ok(8.)

   // ddz/dx (differentiates `z` again)
   let ggx = &g.grad(&[gx], &[x])[0];
   println!("{:?}", ggx.eval(&[]));  // => Ok(4.)
});

Neural networks

This crate has various low-level features inspired by tensorflow/theano to train neural networks. Since computation graphs require only bare minimum of heap allocations, the overhead is small, even for complex networks.

// This is a softmax regression for MNIST digits classification with Adam.
// This achieves 0.918 test accuracy after 3 epochs (0.11 sec/epoch on 2.7GHz Intel Core i5).
use autograd::{self as ag, Graph, optimizers::adam, ndarray_ext as arr, tensor::Variable};

let rng = ag::ndarray_ext::ArrayRng::<f32>::default();
let w_arr = arr::into_shared(rng.glorot_uniform(&[28 * 28, 10]));
let b_arr = arr::into_shared(arr::zeros(&[1, 10]));
let adam_state = adam::AdamState::new(&[&w_arr, &b_arr]);

let max_epoch = 3;

for epoch in 0..max_epoch {
   ag::with(|g| {
       let w = g.variable(w_arr.clone());
       let b = g.variable(b_arr.clone());
       let x = g.placeholder(&[-1, 28*28]);
       let y = g.placeholder(&[-1]);
       let z = g.matmul(x, w) + b;
       let mean_loss = g.reduce_mean(g.sparse_softmax_cross_entropy(z, &y), &[0], false);
       let grads = &g.grad(&[&mean_loss], &[w, b]);
       let update_ops: &[ag::Tensor<f32>] =
           &adam::Adam::default().compute_updates(&[w, b], grads, &adam_state, g);

       // let batch_size = 200isize;
       // let num_samples = x_train.shape()[0];
       // let num_batches = num_samples / batch_size as usize;
       // for i in get_permutation(num_batches) {
       //     let i = i as isize * batch_size;
       //     let x_batch = x_train.slice(s![i..i + batch_size, ..]).into_dyn();
       //     let y_batch = y_train.slice(s![i..i + batch_size, ..]).into_dyn();
       //     g.eval(update_ops, &[x.given(x_batch), y.given(y_batch)]);
       // }
   });
}

ConvNet, LSTM example can be found in examples

Hooks

You can register hooks on ag::Tensor objects for debugging.

use autograd as ag;

ag::with(|g| {
    let a: ag::Tensor<f32> = g.zeros(&[4, 2]).show();
    let b: ag::Tensor<f32> = g.ones(&[2, 3]).show_shape();
    let c = g.matmul(a, b).show_with("MatMul:");

    c.eval(&[]);
    // [[0.0, 0.0],
    // [0.0, 0.0],
    // [0.0, 0.0],
    // [0.0, 0.0]] shape=[4, 2], strides=[2, 1], layout=C (0x1)
    //
    // [2, 3]
    //
    // MatMul:
    //  [[0.0, 0.0, 0.0],
    //  [0.0, 0.0, 0.0],
    //  [0.0, 0.0, 0.0],
    //  [0.0, 0.0, 0.0]] shape=[4, 3], strides=[3, 1], layout=C (0x1), dynamic ndim=2
});

For more, see documentation or examples

Comments
  • Support for lgamma function

    Support for lgamma function

    Hi, i am using autograd to make a neural network with custom defined loss function. That needs the calculation of lgamma function of tensors during the process. I notice that there is tf.math.lgamma() in tensorflow, and i find that would be really complex to define the operation myself using autograd since the gradient of the logarithm of the fraction is really complex for me to understand. Could you have any support for that operation or do you have any advice how can i achieve that? Thanks for your help.

    opened by laocaoshilaocao 22
  • segfault when calling grad() in a loop

    segfault when calling grad() in a loop

    On my x86 linux environment with rust 1.47.0 and autograd 1.0.2 the below code has a segmentation fault.

    Any idea what's causing this crash?

    Given that this segfault happened in a very simple loop and that there's a decent amount of code inside of unsafe{} would it possible/feasible to use conditional compilation that used alternatives to unsafe{} code blocks when they are purely for performance, along with alternative safe versions of datastructures (eg. UnsafeCell, not sure how trustworthy SmallVec is).

    test code:

    ==> Cargo.toml <==
    [package]
    name = "autograd_test"
    version = "0.1.0"
    edition = "2018"
    
    [dependencies]
    autograd = { version = "1.0.2" }
    
    
    ==> src/main.rs <==
    extern crate autograd as ag;
    
    fn main() {
        ag::with(|g: &mut ag::Graph<f64>| {
            let mut loop_iter = 1;
            loop {
                let x = g.placeholder(&[3]);
                let z = 2.0 * x;
                eprintln!("about to call grad() {}", loop_iter);
                g.grad(&[z], &[x])[0];
                eprintln!("grad() call completed {}", loop_iter);
    
                loop_iter += 1;
                if loop_iter >= 1000 { break };
            };
        });
    }
    

    The gdb output and backtrace for me looks like this (this crashes in the --release mode as well for me):

    about to call grad() 1
    grad() call completed 1
    about to call grad() 2
    grad() call completed 2
    ...
    grad() call completed 25
    about to call grad() 26
    grad() call completed 26
    about to call grad() 27
    
    Program received signal SIGSEGV, Segmentation fault.
    smallvec::SmallVec<A>::spilled (self=0x7ffff7fd12c0)
        at /home/ktegan/.cargo/registry/src/github.com-1ecc6299db9ec823/smallvec-1.4.2/src/lib.rs:695
    695	        self.capacity > Self::inline_capacity()
    (gdb) bt
    #0  smallvec::SmallVec<A>::spilled (self=0x7ffff7fd12c0)
        at /home/ktegan/.cargo/registry/src/github.com-1ecc6299db9ec823/smallvec-1.4.2/src/lib.rs:695
    #1  0x0000555555585ab3 in smallvec::SmallVec<A>::triple (self=0x7ffff7fd12c0)
        at /home/ktegan/.cargo/registry/src/github.com-1ecc6299db9ec823/smallvec-1.4.2/src/lib.rs:666
    #2  0x0000555555584bce in smallvec::SmallVec<A>::len (self=0x7ffff7fd12c0)
        at /home/ktegan/.cargo/registry/src/github.com-1ecc6299db9ec823/smallvec-1.4.2/src/lib.rs:646
    #3  0x00005555555d3e1a in autograd::gradient::symbolic_gradients (ys=..., wrt=..., gys=..., g=0x7fffffffda60)
        at /home/ktegan/.cargo/registry/src/github.com-1ecc6299db9ec823/autograd-1.0.2/src/gradient.rs:166
    #4  0x00005555555c5573 in autograd::ops::<impl autograd::graph::Graph<F>>::grad_with_default (
        self=0x7fffffffda60, ys=..., xs=..., ys_grads=...)
        at /home/ktegan/.cargo/registry/src/github.com-1ecc6299db9ec823/autograd-1.0.2/src/ops/mod.rs:128
    #5  0x00005555555c5cbb in autograd::ops::<impl autograd::graph::Graph<F>>::grad (self=0x7fffffffda60, ys_=..., 
        xs=...) at /home/ktegan/.cargo/registry/src/github.com-1ecc6299db9ec823/autograd-1.0.2/src/ops/mod.rs:96
    #6  0x000055555559a42e in autograd_test::main::{{closure}} (g=0x7fffffffda60) at src/main.rs:10
    #7  0x00005555555c6906 in autograd::graph::with (f=...)
        at /home/ktegan/.cargo/registry/src/github.com-1ecc6299db9ec823/autograd-1.0.2/src/graph.rs:91
    #8  0x00005555555bf546 in autograd_test::main () at src/main.rs:4
    
    opened by ktegan 19
  • Segmentation fault on multiple calls to conv2d.

    Segmentation fault on multiple calls to conv2d.

    When trying to make a predict fn involving a conv2d (similar to cnn_mnist), i see Segmentation faults after around 21 calls. Is this a bug or Is there a better way to make predictions?

    Minimum code to reproduce:

    use autograd as ag; 
    use ag::ndarray_ext as array;
    use ag::tensor::Variable;
    
    fn main() {
        let rng = array::ArrayRng::<f32>::default();
        let w1_arr = array::into_shared(rng.random_normal(&[16, 1, 3, 3], 0., 0.5));
        let b1_arr = array::into_shared(array::zeros(&[1, 16, 8, 8]));
    
        ag::with(|g| {
            let rng1 = array::ArrayRng::<f32>::default();
            let w1 = g.variable(w1_arr.clone());
    
            let b1 = g.variable(b1_arr.clone());
            for i in 0..100 {
                println!("Calling pred: {}", i);
                let x = g.variable(rng1.glorot_uniform(&[8, 8]));
                println!("Input value: {:?}", x.eval(&[]));
                let _ = g.conv2d(x, w1, 1, 1) + b1;
            }
        })
    }
    
    bug 
    opened by arjunc77 15
  • Alternatives for `tf.where()`

    Alternatives for `tf.where()`

    Hi, i am working on a simple kmeans clustering algorithm using autogard I want to achieve the same result as this TF code:

    assignments = tf.constant([1, 0, 0])
    c = 1
    tf.where(tf.equal(assignments, c))
    

    It simply returns the indices where the condition is True. I wanna ask do you have any idea of simple alternative method in autogard? Or i should again make my own custom defined op?

    opened by laocaoshilaocao 12
  • Gradient error for tensor of different dimensions

    Gradient error for tensor of different dimensions

    Hi, during the development of my neural network algorithm, i found that gradient method for tensors calculated between two different dimensions always has an error. The error includes thread 'main' panicked at'called Result::unwrap() on an Err value: and thread 'main' panicked at'called Result::unwrap() on an None value: if i try to print the gradresult. One example is like:

    let t1  = g.constant( array![[1.0,2.0, 3.0, 4.0], [1.0,2.0, 3.0, 4.0]] );
    let t2  = g.constant( array![1.0,2.0, 3.0, 4.0] );
    let cal = t1/t2
    let grads = g.grad(&[cal], &[t2]);
    

    That influences a lot for the expression using during the development. After testing, i found that expand t2's dimension can solve that problem by doing like this.

    ...
    let t3 = g.tile(g.expand_dims(t2, &[0]), 0, 2);
    let cal = t1/t3
    ...
    

    However, that way definitely requires much more effort for the development since method like reduced_sum is really commonly used. Do u have any other idea about solving this problem?

    opened by laocaoshilaocao 7
  • How to help?

    How to help?

    Hi @raskr

    I am very new to Rust and lower level programming, but not to tensors or differential equations. (I'm a data scientist.)

    I'd like to help out in some way as a chance to work on my Rust skills while also doing something useful in a field I know/care about.

    I saw that the project had been "asleep" for a while, but that you recently made a commit again. Is there something in your mind that you'd like to tackle?

    opened by lazarillo 7
  • First attempt at moving towards safe code

    First attempt at moving towards safe code

    Tracking unsafe block usage throughout the project I found that unsafes were used for primarily one of two reasons:

    1. To avoid lifetime checks on elements of vectors not outliving the vector
    2. To mutate interior of data without marking the data as mutable

    The first case is probably undesirable though hard to fix. The second case is a perfectly good design pattern which can probably be left alone.

    Attached is a first attempt at restraining the number of unsafe blocks in code. Marking these two functions as unsafe doesn't actually prevent any unsafe behavior, so I just moved the unsafe block inside the body of the function. To remove this unsafe code it would be necessary to fix the 1st case of unsafe behaviors, otherwise the borrow checker will complain. With the code as is, the borrow checker watches the magic trick but doesn't know what happened so it accepts the new lifetime after pointer cast.

    Any feedback is appreciated.

    opened by andrew-johnson-4 6
  • `cnn_mnist` and `lstm_lm` examples runtime failure

    `cnn_mnist` and `lstm_lm` examples runtime failure

    Hi! I'm having some trouble with running a couple of the examples from your project. My process was the following:

    $ git clone https://github.com/raskr/rust-autograd.git
    $ cd rust-autograd/examples
    $ ./download_mnist.sh
    $ RUST_BACKTRACE=1 cargo run --example cnn_mnist
    

    which results in the following error. I've compiled it both with and without the --features mkl flag, and with and without the --release flag, neither of which seems have any effect on these errors. As far as I can tell, they don't seem to be trace back to the same problem, but I may be mistaken. I'm running rustc 1.46.0-nightly (feb3536eb 2020-06-09), on Pop!_OS 20.04 LTS, which closely mirrors Ubuntu. If it would be easier for me to open separate issues for each of these, I would be happy to do so.

    However, I am able to compile and run the mlp_mnist example without issue.

    thread 'main' panicked at 'assertion failed: `(left == right)`
      left: `4`,
     right: `2`', /rustc/feb3536eba10c2e4585d066629598f03d5ddc7c6/src/libstd/macros.rs:16:9
    stack backtrace:
       0: backtrace::backtrace::libunwind::trace
                 at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.46/src/backtrace/libunwind.rs:86
       1: backtrace::backtrace::trace_unsynchronized
                 at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.46/src/backtrace/mod.rs:66
       2: std::sys_common::backtrace::_print_fmt
                 at src/libstd/sys_common/backtrace.rs:78
       3: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
                 at src/libstd/sys_common/backtrace.rs:59
       4: core::fmt::write
                 at src/libcore/fmt/mod.rs:1076
       5: std::io::Write::write_fmt
                 at src/libstd/io/mod.rs:1537
       6: std::sys_common::backtrace::_print
                 at src/libstd/sys_common/backtrace.rs:62
       7: std::sys_common::backtrace::print
                 at src/libstd/sys_common/backtrace.rs:49
       8: std::panicking::default_hook::{{closure}}
                 at src/libstd/panicking.rs:198
       9: std::panicking::default_hook
                 at src/libstd/panicking.rs:218
      10: std::panicking::rust_panic_with_hook
                 at src/libstd/panicking.rs:477
      11: rust_begin_unwind
                 at src/libstd/panicking.rs:385
      12: std::panicking::begin_panic_fmt
                 at src/libstd/panicking.rs:339
      13: ndarray::impl_methods::<impl ndarray::ArrayBase<S,D>>::slice_collapse
                 at /rustc/feb3536eba10c2e4585d066629598f03d5ddc7c6/src/libstd/macros.rs:16
      14: ndarray::impl_methods::<impl ndarray::ArrayBase<S,D>>::slice_move
                 at /home/chrism/.cargo/registry/src/github.com-1ecc6299db9ec823/ndarray-0.12.1/src/impl_methods.rs:325
      15: ndarray::impl_methods::<impl ndarray::ArrayBase<S,D>>::slice
                 at /home/chrism/.cargo/registry/src/github.com-1ecc6299db9ec823/ndarray-0.12.1/src/impl_methods.rs:289
      16: cnn_mnist::main::{{closure}}
                 at examples/cnn_mnist.rs:94
      17: autograd::graph::with
                 at /home/chrism/rust-projects/rust-autograd/src/graph.rs:91
      18: cnn_mnist::main
                 at examples/cnn_mnist.rs:66
      19: std::rt::lang_start::{{closure}}
                 at /rustc/feb3536eba10c2e4585d066629598f03d5ddc7c6/src/libstd/rt.rs:67
      20: std::rt::lang_start_internal::{{closure}}
                 at src/libstd/rt.rs:52
      21: std::panicking::try::do_call
                 at src/libstd/panicking.rs:297
      22: std::panicking::try
                 at src/libstd/panicking.rs:274
      23: std::panic::catch_unwind
                 at src/libstd/panic.rs:394
      24: std::rt::lang_start_internal
                 at src/libstd/rt.rs:51
      25: std::rt::lang_start
                 at /rustc/feb3536eba10c2e4585d066629598f03d5ddc7c6/src/libstd/rt.rs:67
      26: main
      27: __libc_start_main
      28: _start
    note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
    

    When running $ RUST_BACKTRACE=1 cargo run --example lstm_lm, I get the following error:

    thread 'main' panicked at 'lhs input for MatMul must be 2D: ShapeError/IncompatibleShape: incompatible shapes', /home/chrism/rust-projects/rust-autograd/src/ops/dot_ops.rs:536:21
    stack backtrace:
       0: backtrace::backtrace::libunwind::trace
                 at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.46/src/backtrace/libunwind.rs:86
       1: backtrace::backtrace::trace_unsynchronized
                 at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.46/src/backtrace/mod.rs:66
       2: std::sys_common::backtrace::_print_fmt
                 at src/libstd/sys_common/backtrace.rs:78
       3: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
                 at src/libstd/sys_common/backtrace.rs:59
       4: core::fmt::write
                 at src/libcore/fmt/mod.rs:1076
       5: std::io::Write::write_fmt
                 at src/libstd/io/mod.rs:1537
       6: std::sys_common::backtrace::_print
                 at src/libstd/sys_common/backtrace.rs:62
       7: std::sys_common::backtrace::print
                 at src/libstd/sys_common/backtrace.rs:49
       8: std::panicking::default_hook::{{closure}}
                 at src/libstd/panicking.rs:198
       9: std::panicking::default_hook
                 at src/libstd/panicking.rs:218
      10: std::panicking::rust_panic_with_hook
                 at src/libstd/panicking.rs:477
      11: rust_begin_unwind
                 at src/libstd/panicking.rs:385
      12: core::panicking::panic_fmt
                 at src/libcore/panicking.rs:86
      13: core::option::expect_none_failed
                 at src/libcore/option.rs:1272
      14: core::result::Result<T,E>::expect
                 at /rustc/feb3536eba10c2e4585d066629598f03d5ddc7c6/src/libcore/result.rs:963
      15: <autograd::ops::dot_ops::MatMul as autograd::op::Op<T>>::compute
                 at /home/chrism/rust-projects/rust-autograd/src/ops/dot_ops.rs:536
      16: autograd::runtime::<impl autograd::graph::Graph<F>>::eval::{{closure}}
                 at /home/chrism/rust-projects/rust-autograd/src/runtime.rs:390
      17: core::result::Result<T,E>::and_then
                 at /rustc/feb3536eba10c2e4585d066629598f03d5ddc7c6/src/libcore/result.rs:729
      18: autograd::runtime::<impl autograd::graph::Graph<F>>::eval
                 at /home/chrism/rust-projects/rust-autograd/src/runtime.rs:388
      19: autograd::test_helper::check_theoretical_grads
                 at /home/chrism/rust-projects/rust-autograd/src/test_helper.rs:21
      20: lstm_lm::main::{{closure}}
                 at examples/lstm_lm.rs:94
      21: autograd::graph::with
                 at /home/chrism/rust-projects/rust-autograd/src/graph.rs:91
      22: lstm_lm::main
                 at examples/lstm_lm.rs:66
      23: std::rt::lang_start::{{closure}}
                 at /rustc/feb3536eba10c2e4585d066629598f03d5ddc7c6/src/libstd/rt.rs:67
      24: std::rt::lang_start_internal::{{closure}}
                 at src/libstd/rt.rs:52
      25: std::panicking::try::do_call
                 at src/libstd/panicking.rs:297
      26: std::panicking::try
                 at src/libstd/panicking.rs:274
      27: std::panic::catch_unwind
                 at src/libstd/panic.rs:394
      28: std::rt::lang_start_internal
                 at src/libstd/rt.rs:51
      29: std::rt::lang_start
                 at /rustc/feb3536eba10c2e4585d066629598f03d5ddc7c6/src/libstd/rt.rs:67
      30: main
      31: __libc_start_main
      32: _start
    note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
    
    bug 
    opened by quietlychris 5
  • Segfaulting on matrix multiplication with MKL

    Segfaulting on matrix multiplication with MKL

    Matrix multiplication can cause a segault when using MKR. Here is a snippet:

    let W = ag::variable(ag::ndarray_ext::glorot_uniform(&[(output_size as usize)*4, input_size as usize]));
    let s = ag::slice(&W, &[0, 0], &[output_size, -1]);
    let r = ag::matmul(&s, &x);
    

    In the above example, x has dimensions [input_size, 1] and s will have dimensions [output_size, input_size], so matrix multiplication works out. The example runs with no issues without the mkr feature, but with mkr the eval step segfaults. I analyzed with valgrind, and it seems like there a few extra writes happening somewhere, resulting in a segfault.

    bug 
    opened by paulkass 5
  • Calculate add/sub gradient

    Calculate add/sub gradient

    I have been tinkering together a neural network. However, I have been running into some panics. I have managed to boil it down to calculating the gradient of ag::add or ag::sub. Here is the boiled down example:

    use ag;
    use ndarray::prelude::*;
    
    let x_val = array![[0.1]].into_dyn();
    let y_val = array![[0.2]].into_dyn();
    let ref x = ag::placeholder(&[-1, 1]);
    let ref y = ag::placeholder(&[-1, 1]);
    let ref feeds = [(x, &x_val), (y, &y_val)];
    
    let ref z = ag::add(x, y);
    println!("{}", z.eval(feeds));
    
    let ref grads = ag::grad(&[z], &[y]);
    println!("{}", grads[0].eval(feeds)); // panic here
    

    I get the following when I try to run the above:

    [[0.3]]
    thread 'main' panicked at 'ndarray: could not broadcast array from shape: [0] to: [2]', /home/sgibbs/.cargo/registry/src/github.com-1ecc6299db9ec823/ndarray-0.10.14/src/lib.rs:741:13
    note: Run with `RUST_BACKTRACE=1` for a backtrace.
    

    Am I doing something wrong?

    Thanks

    opened by shanegibbs 5
  • Custom Rng

    Custom Rng

    I had an initial pass at https://github.com/raskr/rust-autograd/issues/1 and got this far.

    Looking at src/ops/mod.rs, would you like to keep the original function signatures and add new ones? or something else?

    pub fn random_normal_rng<T: ArrayLike, R: Rng + 'static>(shape: &T, mean: f64, stddev: f64, rng: R) -> Tensor
    
    opened by shanegibbs 5
Owner
Ryo ASAKURA
Ryo ASAKURA
Tiny, no-nonsense, self-contained, Tensorflow and ONNX inference

Sonos' Neural Network inference engine. This project used to be called tfdeploy, or Tensorflow-deploy-rust. What ? tract is a Neural Network inference

Sonos, Inc. 1.5k Jan 8, 2023
Rust language bindings for TensorFlow

TensorFlow Rust provides idiomatic Rust language bindings for TensorFlow. Notice: This project is still under active development and not guaranteed to

null 4.1k Jan 1, 2023
Rust bindings for TensorFlow Lite

Rust bindings for TensorFlow Lite This crates provides TensorFlow Lite APIs. Please read the API documentation on docs.rs Using the interpreter from a

Boncheol Gu 84 Dec 11, 2022
An example of using TensorFlow rust bindings to serve trained machine learning models via Actix Web

Serving TensorFlow with Actix-Web This repository gives an example of training a machine learning model using TensorFlow2.0 Keras in python, exporting

Kyle Kosic 39 Dec 12, 2022
[WIP] An experimental Java-like language and it's virtual machine, for learning Java and JVM.

Sky VM An experimental Java-like language and it's virtual machine, for learning Java and JVM. Dependencies Rust (rust-lang/rust) 2021 Edition, dual-l

Kk Shinkai 2 Jan 3, 2022
Rust-like syntax for OpenGL Shading Language

Rust-like syntax for GLSL glassful translates a small subset of Rust to OpenGL Shading Language. Besides one's personal preferences regarding Rust-lik

Keegan McAllister 158 Sep 22, 2022
Ecosystem of libraries and tools for writing and executing extremely fast GPU code fully in Rust.

Ecosystem of libraries and tools for writing and executing extremely fast GPU code fully in Rust.

Riccardo D'Ambrosio 2.1k Jan 5, 2023
Ecosystem of libraries and tools for writing and executing fast GPU code fully in Rust.

The Rust CUDA Project An ecosystem of libraries and tools for writing and executing extremely fast GPU code fully in Rust Guide | Getting Started | Fe

Rust GPU 2.1k Dec 30, 2022
Robust and Fast tokenizations alignment library for Rust and Python

Robust and Fast tokenizations alignment library for Rust and Python

Yohei Tamura 14 Dec 10, 2022
Narwhal and Tusk A DAG-based Mempool and Efficient BFT Consensus.

This repo contains a prototype of Narwhal and Tusk. It supplements the paper Narwhal and Tusk: A DAG-based Mempool and Efficient BFT Consensus.

Facebook Research 134 Dec 8, 2022
MesaTEE GBDT-RS : a fast and secure GBDT library, supporting TEEs such as Intel SGX and ARM TrustZone

MesaTEE GBDT-RS : a fast and secure GBDT library, supporting TEEs such as Intel SGX and ARM TrustZone MesaTEE GBDT-RS is a gradient boost decision tre

MesaLock Linux 179 Nov 18, 2022
Some hacks and failed experiments surrounding nvidia's gamestream protocol and sunshine/moonlight implementations

Sunrise This repository contains a bunch of experiments surrounding the nvidia gamestream protocol and reimplementations in the form of sunshine and m

Victoria Brekenfeld 5 Dec 21, 2022
Msgpack serialization/deserialization library for Python, written in Rust using PyO3, and rust-msgpack. Reboot of orjson. msgpack.org[Python]

ormsgpack ormsgpack is a fast msgpack library for Python. It is a fork/reboot of orjson It serializes faster than msgpack-python and deserializes a bi

Aviram Hassan 139 Dec 30, 2022
Distributed compute platform implemented in Rust, and powered by Apache Arrow.

Ballista: Distributed Compute Platform Overview Ballista is a distributed compute platform primarily implemented in Rust, powered by Apache Arrow. It

Ballista 2.3k Jan 3, 2023
A fast, safe and easy to use reinforcement learning framework in Rust.

RSRL (api) Reinforcement learning should be fast, safe and easy to use. Overview rsrl provides generic constructs for reinforcement learning (RL) expe

Thomas Spooner 139 Dec 13, 2022
Rust implementation of real-coded GA for solving optimization problems and training of neural networks

revonet Rust implementation of real-coded genetic algorithm for solving optimization problems and training of neural networks. The latter is also know

Yury Tsoy 19 Aug 11, 2022
A real-time implementation of "Ray Tracing in One Weekend" using nannou and rust-gpu.

Real-time Ray Tracing with nannou & rust-gpu An attempt at a real-time implementation of "Ray Tracing in One Weekend" by Peter Shirley. This was a per

null 89 Dec 23, 2022
A neural network, and tensor dynamic automatic differentiation implementation for Rust.

Corgi A neural network, and tensor dynamic automatic differentiation implementation for Rust. BLAS The BLAS feature can be enabled, and requires CBLAS

Patrick Song 20 Nov 7, 2022
K-dimensional tree in Rust for fast geospatial indexing and lookup

kdtree K-dimensional tree in Rust for fast geospatial indexing and nearest neighbors lookup Crate Documentation Usage Benchmark License Usage Add kdtr

Rui Hu 154 Jan 4, 2023