ndarray
ndarray copied to clipboard
Add dlpack support
trafficstars
DLPack is an open in-memory tensor structure for sharing tensors among frameworks. DLPack enables
- Easier sharing of operators between deep learning frameworks.
- Easier wrapping of vendor level operator implementations, allowing collaboration when introducing new devices/ops.
- Quick swapping of backend implementations, like different version of BLAS
- For final users, this could bring more operators, and possibility of mixing usage between frameworks.
Supporting dlpack will make it easier to share tensors with dfdx, tch-rs and even numpy, torch in Python (with pyo3 feature).
I don't know much about dlpack, but I'm quite sure this won't be merged if
- it's not hidden behind a feature gate
- it doesn't use a real crates.io version (not git)
This is still a draft. The api of dlpark is still evolving and I'll release v0.3.0 this week. I want to utilize the ownership system to make sure dlpack can only be consumed once, otherwise there will be double free error. And thanks for your advice, I will add the feature gate.