Skip to main content

arraybridge

ArrayBridge provides explicit conversion and shared lifecycle utilities for NumPy, CuPy, PyTorch, TensorFlow, JAX, and pyclesperanto arrays.

Core dependencies are NumPy and metaclass-registry. Other frameworks are optional.

Quick start

import numpy as np

from arraybridge import convert_memory, detect_memory_type

value = np.arange(6).reshape(2, 3)
assert detect_memory_type(value) == "numpy"

copy = convert_memory(
    value,
    source_type="numpy",
    target_type="numpy",
    gpu_id=0,
)

convert_memory requires the declared source type, target type, and device id. The source and target MemoryType declarations perform conversion directly. The device id is required even for CPU conversions so call sites have one stable signature. A GPU target must declare that identifier as available; ArrayBridge does not silently place the value on the CPU.

Declarative decorators

from arraybridge import numpy

@numpy
def normalize(image):
    return image / max(float(image.max()), 1.0)

The framework decorators attach input_memory_type, output_memory_type, and execution_memory_type metadata, provide dtype/slice runtime parameters, and add framework-specific stream/OOM handling where supported. They do not convert inputs or outputs between frameworks and do not accept a gpu_id argument. A host runtime must call convert_memory at the boundary it plans and scope execution using the execution declaration.

Stack utilities

import numpy as np

from arraybridge import stack_slices, unstack_slices

slices = [np.zeros((8, 8)), np.ones((8, 8))]
stack = stack_slices(slices, memory_type="numpy", gpu_id=0)
restored = unstack_slices(stack, memory_type="numpy", gpu_id=0)

stack_slices requires non-empty 2D inputs. unstack_slices requires a 3D array. Both validate shape and use explicit target memory/device declarations.

Installation

pip install arraybridge
pip install "arraybridge[torch]"
pip install "arraybridge[cupy]"

Documentation: https://arraybridge.readthedocs.io

Metadata

Release files for arraybridge 0.3.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for arraybridge 0.3.4
File Size Uploaded
arraybridge-0.3.4.tar.gz 97.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for arraybridge 0.3.4
File Interpreter ABI Platform
arraybridge-0.3.4-py3-none-any.whl Python 3 none any Details

Total release size: 131.6 kB

Release files / arraybridge-0.3.4.tar.gz

Download URL arraybridge-0.3.4.tar.gz
Size 97.0 kB
Tags Source
SHA-256 checksum
How to use checksums
15b6c64b86473cecdca8d244f66c2d375e7c00150d1f7e2d2a852d9f4f57b1ed
BLAKE2b-256 checksum
How to use checksums
0f8a5be9ea8d88e6923e28e9ccf9406ea11a39d75e338ec6dcd935382b59a559
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 19, 2026.

Transparency log

Release files / arraybridge-0.3.4-py3-none-any.whl

Download URL arraybridge-0.3.4-py3-none-any.whl
Size 34.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fbcbdb3271dbfb96e4dcdb79ed7ac8bb16e1683592fbd49b53a41ba07c8067fd
BLAKE2b-256 checksum
How to use checksums
2c6d9c15da3414f0e9cf507ec99a06a55ae372599f0aa03283eb3fba6fbddf14
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 19, 2026.

Transparency log

Release history Release notifications | RSS feed

0.3.6

2 release files

This release

0.3.4 This release

2 release files

0.3.3

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.11

2 release files

0.2.10

2 release files

0.2.9

2 release files

0.2.8

2 release files

0.2.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page