Skip to content

Interoperability

Tenzr moves data in and out through standard protocols — no adapters required.

  • NumPy — zero-copy via the buffer protocol and __array__ (np.asarray(a), tenzr.array(ndarray)).
  • JAX / PyTorch / CuPy / TensorFlow — zero-copy via DLPack (tenzr.from_dlpack(x) and each framework's own from_dlpack), on matching devices.
  • Python lists / tuples — tenzr.array([...]).
  • pandas / polars / h5py / zarr — pass their NumPy view (df.to_numpy(), dataset[:]).
  • safetensors — native read/write in the C++ core.

Example

import jax
import jax.numpy as jnp
import numpy as np
import tenzr

a = tenzr.array(np.arange(4, dtype=np.float32))  # NumPy -> Tenzr
b = np.asarray(a)                                # Tenzr -> NumPy

j = jnp.arange(4, dtype=jnp.float32)
c = tenzr.from_dlpack(j)                         # JAX -> Tenzr (same device)
d = jax.dlpack.from_dlpack(a)                    # Tenzr -> JAX (same device)