Is Rust good for deep learning and artificial intelligence?

#21

Semi-official binding exists

#22

“Rust for TensorFlow” is something completely different from Rust binding to TensorFlow.

#23

Sorry, didn’t read carefully. I see what you mean! hesitant though! justification is lacking imho.

#24

Maybe off topic but take a look at https://www.weld.rs/

1 Like
#25

So I don’t think Rust is great for doing training, but I have a clone of the AlphaZero algorithm (which is a flavor of Monte Carlo tree search), written in Rust, but using the Rust TensorFlow bindings when it needs to do inference, and Python for training.

Rust was a great fit for this project because the AZ algorithm is abstract, and it works for any two-player game with rules you can encode into a computer program. In Rust, this translates into implementing a trait - the GameExpert trait, and then calling the library to start sampling the game space and finding better moves.

Rust made it easy to efficiently break the implementation of a GameExpert into a separate crate from the implementation of the fairly complicated tree searching algorithm.

It’s also reasonable for this application to use Tensorflow Serving (C++ RPC server) to do the forward inferences that are necessary when playing a game.

Before Rust could be the implementation language for an inference/training library, I think it will need const generics. (This applies for a lot of numerical applications besides machine learning).

Also agree with above that Rust For TensorFlow would be a great addition to Rust.

1 Like
#26

Sorry I am not at all knowledgeable about ML or anything like that, but I am curious: why do you need const generics?

#27

So the compiler can generate efficient implementations of matrix operations for matrices of arbitrary dimensions.

#28

Next question: why isn’t it in the language? Is there any technical reason? I am not sure where, so more experienced forum users should help, but you can discuss this with the language design team somewhere.

#29

It’s a SMOP (“Simple Matter of Programming”)

#30

Snips, an edge AI company, is working on an inference engine for TensorFlow models and ONNX models written in Rust. Apparently it is faster than TensorFlow Lite!

2 Likes
#31

So this interface engine, is it an AI library?

#32

Yes, Tract is an AI library. You can use it to run models. You cannot use it to train models.

1 Like