Optorch v0.1.0
The first public release of Optorch, a NumPy-based differentiable photonic computing framework.
Highlights
- Pure NumPy implementation with zero PyTorch dependency
- GPU acceleration via CuPy (auto-detect, zero code change)
- Physics-based adjoint autodifferentiation
- MZI optical neural network layers (Clements decomposition)
- Diffractive optical layers (D2NN)
- Phase mask layers
- Physical noise modeling for noise-aware training
- Arbitrary matrix auto-decomposition (SVD + Clements)
- Trainer framework with checkpointing and LR schedulers
- Custom gradient registry API
Installation
pip install -e .Quick Start
import optorch
field = optorch.OpticalField.uniform_plane(shape=(1024, 1024))
field_gpu = field.to_gpu()
model = optorch.OpticalNetwork([
optorch.MZILayer(n_modes=1024),
optorch.PhaseMaskLayer(shape=(1024,))
])
output = model.forward(field_gpu)See README.md for full documentation.
中文: Optorch 首个公开发布版本,基于 NumPy 的可微分光计算模拟框架。
核心特性
- 纯 NumPy 实现,零 PyTorch 依赖
- CuPy GPU 加速(自动检测,无需改代码)
- 物理伴随法自动微分
- MZI 光神经网络层(Clements 分解)
- 衍射光学层(D2NN)
- 相位掩模层
- 物理噪声建模(噪声感知训练)
- 任意矩阵自动分解(SVD + Clements)
- Trainer 训练框架(含 checkpoint 和学习率调度)
- 自定义梯度注册 API
完整文档见 README.md。