Python API reference

This reference is generated from the public Python modules in the same checkout as the website. Signatures and docstrings update with the code. It describes version 0.1.0a2 on main; unreleased changes may precede the PyPI package. The Python SDK version is independent of the Rust crate and protocol versions.

Start with the Python guide for installation, device selection, backend prerequisites and tested examples. Calls to the NumPy-style namespace are CPU reference operations unless traced and explicitly compiled for a device.

A reference calculation

This example runs in documentation CI without accelerator hardware:

>>> import numpy as np
>>> import virtio_accel as va
>>> import virtio_accel.numpy as vnp
>>> @va.jit(backend="reference")
... def relu(x):
...     return vnp.maximum(x, 0)
>>> relu(np.array([-2, 0, 3], dtype=np.float32)).to_numpy().tolist()
[0.0, 0.0, 3.0]