ndarray icon indicating copy to clipboard operation
ndarray copied to clipboard

Add dlpack support

Open SunDoge opened this issue 2 years ago • 2 comments
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).

SunDoge avatar Jul 14 '23 06:07 SunDoge

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)

nilgoyette avatar Jul 17 '23 01:07 nilgoyette

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.

SunDoge avatar Jul 17 '23 01:07 SunDoge