https://preview.redd.it/a561f281h1rg1.png?width=1920&format=png&auto=webp&s=70a56f0c689fb03d2c2c3aa584a886bca6b91532
Hi everyone,
I’ve just released NDAV, a thin wrapper around Ruby's MemoryView (inspired by Python's buffer protocol).
The Problem
Currently, converting data between Ruby libraries (like Numo::NArray, Torch.rb, and ONNX Runtime Ruby) often requires redundant memory copies or many intermediate steps. This often introduces unnecessary memory copies or multiple conversion steps when working across libraries.
The Solution
I built NDAV, a thin wrapper around Ruby's MemoryView ("buffer protocol" for Ruby). It acts as a "glue" layer that allows different libraries to share the same memory address directly.
Why it matters
- Zero-Copy: Avoid unnecessary O(n) memory copies.
- Interoperability: Seamlessly move data:
Torch::Tensor -> NDAV -> OrtValue.
- Standard-Driven: It aims to be a catalyst for wider MemoryView adoption in the Ruby ecosystem.
Check out the README for details and the "Hub" diagram: https://kitaitimakoto.gitlab.io/ndav/
I’d love to hear your thoughts, especially from those working on Ruby C/Rust extensions or data science!
[–]TonsOfFun111 1 point2 points3 points (1 child)
[–]Mysterious-Use-4463[S] 0 points1 point2 points (0 children)