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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

arraybridge-0.3.2.tar.gz (95.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

arraybridge-0.3.2-py3-none-any.whl (33.6 kB view details)

Uploaded Python 3

File details

Details for the file arraybridge-0.3.2.tar.gz.

File metadata

  • Download URL: arraybridge-0.3.2.tar.gz
  • Upload date:
  • Size: 95.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for arraybridge-0.3.2.tar.gz
Algorithm Hash digest
SHA256 f7a1ea472a633237a9de8330f049dd985627d9e0afb81a3f56952ecee8789bfe
MD5 fe7e86f6453e48bdde31c5c68deb865a
BLAKE2b-256 700ed299f375db8ddfa2bdf43eebba4ea33629c10627a39599c23127982a4fcf

See more details on using hashes here.

Provenance

The following attestation bundles were made for arraybridge-0.3.2.tar.gz:

Publisher: publish.yml on OpenHCSDev/ArrayBridge

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file arraybridge-0.3.2-py3-none-any.whl.

File metadata

  • Download URL: arraybridge-0.3.2-py3-none-any.whl
  • Upload date:
  • Size: 33.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for arraybridge-0.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 0208a8be370e53b2d0c33415bdc420ffdc6bd409904f27a0884e991684454c79
MD5 0b295a8e8a21849af7e707c93fe994e0
BLAKE2b-256 93cc28d6af6fc183d2a71ef5184931bc7ac6cbf91cae32d16546d8a1a2589384

See more details on using hashes here.

Provenance

The following attestation bundles were made for arraybridge-0.3.2-py3-none-any.whl:

Publisher: publish.yml on OpenHCSDev/ArrayBridge

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

0.3.3

2 files

This release

0.3.2 This release

2 files

0.3.1

2 files

0.3.0

2 files

0.2.11

2 files

0.2.10

2 files

0.2.9

2 files

0.2.8

2 files

0.2.0

2 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