Repository navigation
PyWebNN v0.1.0 - Experimental Release
Pre-release
Pre-release
⚠️ EXPERIMENTAL RELEASE - NOT FOR PRODUCTION
DO NOT USE IN PRODUCTION. This is a proof-of-concept for research and experimentation only.
This is the first experimental release of PyWebNN, a Python implementation of the W3C WebNN API with Rust bindings.
🎯 Features
- 🐍 Python WebNN API - Complete W3C WebNN specification implementation
- 📊 ONNX Conversion - Full operation support, cross-platform
- 🍎 CoreML Conversion - Basic operations (add, matmul) for macOS
- ✅ Graph Validation - Comprehensive validation matching Chromium's WebNN
- 🔍 Visualization - Generate Graphviz diagrams
- 📦 NumPy Integration - Seamless tensor data conversion
- 🌐 Cross-platform - Linux, macOS, Windows wheels
📥 Installation
pip install pywebnn🚀 Quick Start
import webnn
import numpy as np
# Create context and builder
ml = webnn.ML()
context = ml.create_context(device_type="cpu")
builder = context.create_graph_builder()
# Build a simple neural network layer
input_tensor = builder.input("input", [1, 4], "float32")
weights = np.random.randn(4, 3).astype(np.float32)
weights_const = builder.constant(weights)
output = builder.matmul(input_tensor, weights_const)
# Compile and convert
graph = builder.build({"output": output})
context.convert_to_onnx(graph, "model.onnx")
print("✓ Model saved to model.onnx")📚 Documentation
⚠️ Known Limitations
- CoreML: Only supports add and matmul operations (activations coming soon)
- Execution: No actual tensor computation in
compute()yet - only conversion - Operations: Subset of WebNN spec implemented (see TODO.txt)
- Testing: Limited test coverage, use for experimentation only
🛠️ What's Included
This release includes pre-built wheels for:
- Linux: x86_64, aarch64 (manylinux)
- macOS: x86_64 (Intel), aarch64 (Apple Silicon)
- Windows: x64, x86
- Python: 3.8, 3.9, 3.10, 3.11, 3.12
🔗 Links
- PyPI: https://pypi.org/project/pywebnn/
- Repository: https://github.com/tarekziade/rustnn
- Issues: https://github.com/tarekziade/rustnn/issues
- W3C WebNN Spec: https://www.w3.org/TR/webnn/
🙏 Acknowledgments
Built with PyO3, Maturin, and inspired by the W3C WebNN Community Group.
Made with ❤️ by Tarek Ziadé