xtensor-stack / xtensor

C++ tensors with broadcasting and lazy computing
BSD 3-Clause "New" or "Revised" License
3.35k stars 398 forks source link

Rust bindings for xtensor #2390

Open TheButlah opened 3 years ago

TheButlah commented 3 years ago

Hi! It would be awesome to have the ability to have a xt::rusttensor much like xt::pytensor. Is there any interest in adding rust as a supported language, and what would something like that look like?

A conversion from xt::tensor to ndarray::Array and vice versa would be more than sufficient and is probably the ideal approach.

TheButlah commented 3 years ago

See also: https://github.com/PyO3/rust-numpy for how rust does this with python's NumPy library.

JohanMabille commented 3 years ago

Is there any interest in adding rust as a supported language, [...]

Definitely, that would awesome!

[...] and what would something like that look like?

I'm not familiar with Rust nor the way to expose C++ API to it, but I guess being able to wrap the N-dimensional array from Rust would be a good start. I'm afraid that conversion avoids changing the array in place; on the other hand, that might be something you want to guarantee and in that case a conversion totally makes sense.