# DLPack Source: https://www.tensorplay.cn/docs/dlpack.html [DLPack](https://dmlc.github.io/dlpack/) is a neutral, zero-copy exchange format for tensors. It lets two different libraries hand a tensor back and forth without copying the data, describing only the shape, strides, data type, and device. TensorPlay interoperates with it through tensorplay.from_dlpack. ``` import tensorplay as tp # a DLPack capsule is an opaque handle to a tensor x = tp.ones(3, 4) capsule = tp.to_dlpack(x) y = tp.from_dlpack(capsule) # wraps the same data, no copy print(y.shape) # (3, 4) ``` tensorplay.from_dlpack wraps data owned by another library, and tensorplay.to_dlpack hands ours out in the same format. Because the data is shared rather than copied, both ends must respect the tensor’s lifetime and the device contract — the capsule owns the underlying memory and the two sides agree on when it is valid. | tensorplay.from_dlpack | | | --- | --- | | tensorplay.to_dlpack | Exports obj as a DLPack capsule without copying its data. | ## Where to go next - [Tensors](/docs/tensorplay.html) — the tensor APIs from_dlpack and to_dlpack interoperate with. - [NumPy interop](/docs/notes/serialization.html) — the other zero-copy conversion path.