arraybridge Documentation
Unified API for NumPy, CuPy, PyTorch, TensorFlow, JAX, and pyclesperanto
arraybridge provides a unified interface for working with multiple array/tensor frameworks, featuring automatic memory type conversion, declarative decorators, and zero-copy operations when possible.
Getting Started
User Documentation
API Documentation
Examples
Development
Features
Unified API: Single interface for 6 array/tensor frameworks
Automatic Conversion: DLPack + NumPy fallback with automatic path selection
Declarative Decorators:
@numpy,@torch,@cupyfor memory type declarationsDevice Management: Thread-local GPU contexts and automatic stream management
OOM Recovery: Automatic out-of-memory detection and cache clearing
Dtype Preservation: Automatic dtype preservation across conversions
Zero Dependencies: Only requires NumPy (framework dependencies are optional)
Quick Example
from arraybridge import convert_memory, detect_memory_type
import numpy as np
# Create NumPy array
data = np.array([[1, 2], [3, 4]])
# Convert to PyTorch (if installed)
torch_data = convert_memory(data, source_type='numpy', target_type='torch', gpu_id=0)
# Detect memory type
mem_type = detect_memory_type(torch_data) # 'torch'
Installation
# Base installation (NumPy only)
pip install arraybridge
# With specific frameworks
pip install arraybridge[torch]
pip install arraybridge[cupy]
pip install arraybridge[all]