skillfed

roma

A lightweight library to deal with 3D rotations in PyTorch.

roma v1.6 238.1K downloads/30d#8,947 on PyPI641
Permissive license BSD-3-Clause Active released

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 roma

uv

uv add roma

poetry

poetry add roma

Installing 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

Operating System :: OS IndependentProgramming Language :: Python :: 3

Tags

3d rotation pytorchrotation representation conversiondifferentiable rotation mathquaternion rotation matrixrotation space optimizationeuler angles pytorchrotation interpolationrigid transformation pytorch
rotation-geometrypytorch-mathdifferentiable-computing

More Mathematics packages