Construct a Lucid tensor from any object exposing the DLPack
protocol (__dlpack__) or from a raw PyCapsule.
Two dialects, picked by what the producer says it is:
- Metal (
__dlpack_device__() == (8, 0)) — adopted natively. The producer'sMTLBufferbecomes this tensor's storage with no copy at all, which is what makes anmlx.core.arrayand a Lucid Metal tensor two views of one allocation. NumPy cannot read a capsule of this device type, so this path bypasses it entirely. - Everything else — through NumPy, which shares host memory
where it can. The result lives on the CPU regardless of the
producer's device; call
.to("metal")after importing.
Requires numpy for the host dialect — install via
pip install lucid[numpy] if missing. The Metal dialect needs
nothing.