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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file arraybridge-0.3.1.tar.gz.
File metadata
- Download URL: arraybridge-0.3.1.tar.gz
- Upload date:
- Size: 95.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
93af611ce4b8bd21ad0ed4f93f7e6c1be104c52e23fbd952324b150c28dc83c1
|
|
| MD5 |
95a75b9a18edb3951e89b4aefc3768c8
|
|
| BLAKE2b-256 |
ffda1a984e7d6bfb8508e222a5dd3a8125df7faffbbbab2c453e99f7d4d322f6
|
Provenance
The following attestation bundles were made for arraybridge-0.3.1.tar.gz:
Publisher:
publish.yml on OpenHCSDev/ArrayBridge
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
arraybridge-0.3.1.tar.gz -
Subject digest:
93af611ce4b8bd21ad0ed4f93f7e6c1be104c52e23fbd952324b150c28dc83c1 - Sigstore transparency entry: 2558175229
- Sigstore integration time:
-
Permalink:
OpenHCSDev/ArrayBridge@c80cd1e500de6f9c6bb297856a9c5d1b847b7691 -
Branch / Tag:
refs/tags/v0.3.1 - Owner: https://github.com/OpenHCSDev
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@c80cd1e500de6f9c6bb297856a9c5d1b847b7691 -
Trigger Event:
push
-
Statement type:
File details
Details for the file arraybridge-0.3.1-py3-none-any.whl.
File metadata
- Download URL: arraybridge-0.3.1-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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0589ec5501db38471cb759d9027754fde751211ab9ef5983f89d1263795cee22
|
|
| MD5 |
e7f2d674f28d4771444ecfa8e1bc0abf
|
|
| BLAKE2b-256 |
0e69c88c43f32102bea78139745072408eff814ebd2c0b59023ce2d4643e1dfa
|
Provenance
The following attestation bundles were made for arraybridge-0.3.1-py3-none-any.whl:
Publisher:
publish.yml on OpenHCSDev/ArrayBridge
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
arraybridge-0.3.1-py3-none-any.whl -
Subject digest:
0589ec5501db38471cb759d9027754fde751211ab9ef5983f89d1263795cee22 - Sigstore transparency entry: 2558175733
- Sigstore integration time:
-
Permalink:
OpenHCSDev/ArrayBridge@c80cd1e500de6f9c6bb297856a9c5d1b847b7691 -
Branch / Tag:
refs/tags/v0.3.1 - Owner: https://github.com/OpenHCSDev
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@c80cd1e500de6f9c6bb297856a9c5d1b847b7691 -
Trigger Event:
push
-
Statement type: