jax.dlpack.from_dlpack — JAX documentation (original) (raw)

jax.dlpack.from_dlpack#

jax.dlpack.from_dlpack(external_array, device=None, copy=None)[source]#

Returns a Array representation of a DLPack tensor.

The returned Array shares memory with external_array if no device transfer or copy was requested.

Parameters:

Returns:

A jax.Array

Note

While JAX arrays are always immutable, dlpack buffers cannot be marked as immutable, and it is possible for processes external to JAX to mutate them in-place. If a jax Array is constructed from a dlpack buffer and the buffer is later modified in-place, it may lead to undefined behavior when using the associated JAX array.