roma
A lightweight library to deal with 3D rotations in PyTorch.
What it is and what it does
RoMa is a PyTorch library for working with 3D rotations in machine learning pipelines. It handles conversions between common rotation representations—rotation vectors, unit quaternions, rotation matrices, and Euler angles—while maintaining differentiability throughout for backpropagation. The library also provides rotation-space metrics (geodesic distance, cosine angle), quaternion operations, spherical interpolation, and rigid transformation composition.
The package targets researchers and engineers building neural networks or optimization systems that need to reason about 3D rotations. It abstracts away the mathematical complexity of rotation manifolds and provides utilities like Procrustes orthonormalization and Gram-Schmidt orthogonalization for converting arbitrary matrices to valid rotations. Batch operations are supported naturally across arbitrary dimensions.
Use it for:
- Train neural networks that predict 3D rotations or rotation-parameterized transformations in computer vision or robotics
- Implement gradient-based optimization over rotation space for pose estimation or alignment problems
- Convert between rotation representations in a differentiable pipeline without breaking the computational graph
- Interpolate smoothly between rotations using spherical interpolation for animation or trajectory generation
- Compose and invert rigid transformations (rotation + translation) in batch form for 3D geometry operations
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
RoMa provides differentiable conversions between 3D rotation representations (rotation vectors, quaternions, rotation matrices, Euler angles) and utilities for rotation-space operations in PyTorch, designed for machine learning and gradient-based optimization.
Yes. RoMa is actively maintained, has no known vulnerabilities, installs with minimal friction (two common dependencies), and fills a specific need for differentiable rotation handling in PyTorch. The permissive BSD-3-Clause license poses no barrier. Install it if your project involves 3D rotations, pose estimation, or rotation-aware neural networks.
Install
roma on PyPI
pip
pip install romauv
uv add romapoetry
poetry add romaInstalling roma
Before you install
Low friction: pure Python wheel with only torch and numpy as runtime dependencies. Actively maintained with a recent release (3 days old) and steady repository activity.
License in practice
BSD-3-Clause permissive license allows commercial and private use with minimal restrictions; attribution and license notice required in distributions.
Quickstart
pip install roma
import torch
import roma
rotvec = torch.randn(2, 3, 3)
q = roma.rotvec_to_unitquat(rotvec)
R = roma.unitquat_to_rotmat(q)
Requires PyTorch and NumPy; Python >= 3.8
Verify before relying
- Performance characteristics (speed, memory) relative to alternatives for large-scale rotation operations
- Numerical stability guarantees for edge cases (near-singularities, very small rotations)
- Completeness of gradient support across all conversion functions
Package facts
| License | BSD-3-Clause (permissive) |
| Python support | supports the current Python release (>=3.8) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 2 — torch, numpy |
| Maintenance | actively maintained — 3 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 238,121/month — #8,947 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: roma-1.6-py3-none-any.whl
Tags
More Mathematics packages
NetworkX provides data structures and…
permissive · top 1,000 on PyPI
kiwisolverkiwisolver is a Python binding to a fast C++…
permissive · top 1,000 on PyPI
sympySymPy is a Python library for symbolic…
permissive · top 1,000 on PyPI
contourpyContourPy calculates contours of 2D…
permissive · top 1,000 on PyPI
torchPyTorch provides GPU-accelerated tensor…
permissive · top 1,000 on PyPI
onnxruntimeonnxruntime loads and executes Open Neural…
permissive · top 1,000 on PyPI
transformationsCalculates 4x4 homogeneous transformation…
permissive · top 5,000 on PyPI
transforms3dConverts between different 3D geometric…
permissive · top 15,000 on PyPI
jaxliejaxlie implements Lie groups (SO2, SE2, SO3,…
permissive · top 15,000 on PyPI
numpy-quaternionAdds a quaternion dtype to NumPy, enabling…
permissive · top 5,000 on PyPI
pyquaternionProvides quaternion representation,…
permissive · top 5,000 on PyPI
tensorflow-graphicsTensorFlow Graphics provides differentiable…
permissive · top 15,000 on PyPI
pipablepytorch3dPyTorch3D provides reusable components for 3D…
permissive · top 5,000 on PyPI
pytransform3dpytransform3d provides operations, conversions,…
permissive · top 15,000 on PyPI
colormathColormath performs color space conversions,…
permissive · top 15,000 on PyPI