需先自行安装 PyTorch,从源码安装还要装 requirements/runtime.txt 中的依赖;示例默认跑在 CUDA 上,无 GPU 时需手动改设备;稀疏优化示例依赖 v0.9.5 及以上版本。
pypose
pyposeApache-2.0活跃维护面向机器人位姿与流形优化的可微分编程库,把李群、位姿估计和卡尔曼滤波等模块接入 PyTorch,方便在深度学习里做几何优化与状态估计。
A library for differentiable robotics on manifolds.
pip install pyposeREADME 未说明最低显存或 CPU 要求;示例代码默认使用 CUDA 设备(torch.device("cuda")),需先安装对应版本的 PyTorch。
基于 PyTorch 的机器人学习库,把李群李代数、可微优化和二阶求解器整合在一起
面向机器人位姿与流形优化的可微分编程库,把李群、位姿估计和卡尔曼滤波等模块接入 PyTorch,方便在深度学习里做几何优化与状态估计。
核心能力
- 提供 SO3、SE3、Sim3 等李群与李代数的可微 LieTensor
- 内置 EKF、UKF、PF 滤波器与 IMU 预积分、PnP、LQR 模块
- 提供 GaussNewton、LevenbergMarquardt 等二阶优化器
- 支持李群雅可比的批量并行计算,效率优于 Theseus
- v0.9.5 起支持稀疏雅可比追踪与稀疏二阶优化加速光束法平差
容易踩的坑
- v0.9.5最新正式版2026-04-12 · 2026-04-12 23:07 UTC
What's Changed
- API changed to be much simpler for optimization with Sparse Jacobian!
- Add argument
sjacfor pp.Parameter @zitongzhan in https://github.com/pypose/pypose/pull/392 - Remove unnecessary
TrackingTensorby @zitongzhan in https://github.com/pypose/pypose/pull/390 - Add comprehensive doc by @zitongzhan in https://github.com/pypose/pypose/pull/391
Full Changelog: https://github.com/pypose/pypose/compare/v0.9.0...v0.9.5
- v0.9.02026-04-08 · 2026-04-08 15:03 UTC
查看更新说明
What's Changed
- Bundle Adjustment in the eager mode by @zitongzhan in https://github.com/pypose/pypose/pull/378
- Accelerate BA by more than 100 times compare to the last version, more than 20 times than GTSAM!
Full Changelog: https://github.com/pypose/pypose/compare/v0.7.5...v0.9.0
- v0.7.52025-12-21 · 2025-12-21 17:10 UTC
查看更新说明
What's Changed
- Update setup.py for description by @wang-chen in https://github.com/pypose/pypose/pull/384
- update installation command for editable mode and include python 3.12 - 3.14 by @wang-chen in https://github.com/pypose/pypose/pull/385
Full Changelog: https://github.com/pypose/pypose/compare/v0.7.4...v0.7.5
- v0.7.42025-12-20 · 2025-12-20 20:04 UTC
查看更新说明
What's Changed
- Raise explicit exception on optimizing w/ inference_mode. by @MarkChenYutian in https://github.com/pypose/pypose/pull/382
- Better type annotation for
LieType.Mulmethod. by @MarkChenYutian in https://github.com/pypose/pypose/pull/383
Full Changelog: https://github.com/pypose/pypose/compare/v0.7.3...v0.7.4
- v0.7.3V0.7.32025-03-28 · 2025-03-28 23:29 UTC
查看更新说明
What's Changed
- fix bugs in pytest (metric and lqr) by @rokeeeto-li in https://github.com/pypose/pypose/pull/372
- Fixed mpc example bugs based on pr 369. Thanks @andreaostuni by @rokeeeto-li in https://github.com/pypose/pypose/pull/373
- update EKF example by @haleqiu in https://github.com/pypose/pypose/pull/363
Full Changelog: https://github.com/pypose/pypose/compare/v0.7.2...v0.7.3
用户点评
登录用户的真实使用记录,可按版本和硬件筛选还没有人点评。第一个说出真实体验的人最有价值。
PyPose: A Library for Robot Learning with Physics-based Optimization

Deep learning has had remarkable success in robotic perception, but its data-centric nature suffers when it comes to generalizing to ever-changing environments. By contrast, physics-based optimization generalizes better, but it does not perform as well in complicated tasks due to the lack of high-level semantic information and the reliance on manual parametric tuning. To take advantage of these two complementary worlds, we present PyPose: a robotics-oriented, PyTorch-based library that combines deep perceptual models with physics-based optimization techniques. Our design goal for PyPose is to make it user-friendly, efficient, and interpretable with a tidy and well-organized architecture. Using an imperative style interface, it can be easily integrated into real-world robotic applications.
Current Features
LieTensor
Modules
- System:
LTI,LTV,NLS - Filter:
EKF,UKF,PF - PnP Solver:
EPnP - Linear Quadratic Regulator:
LQR - IMU Preintegration:
IMUPreintegrator - ......
Second-order Optimizers
GaussNewtonLevenbergMarquardt- ......
Want more features? Create an issue here to request new features.
PyPose is highly efficient and supports parallel computing for Jacobian of Lie group and Lie algebra. See following comparison.
Efficiency and memory comparison of batched Lie group operations (we take Theseus performance as 1×).
More information about efficiency comparison goes to our paper for PyPose.
Getting Started
Installation
Install from pypi
pip install pypose
Install from source
- Requirement:
On Ubuntu, macOS, or Windows, install PyTorch, then run:
pip install -r requirements/runtime.txt
- Install locally:
git clone https://github.com/pypose/pypose.git
cd pypose && pip install -e .
- Run tests
pytest
For contributors
-
Make sure the above installation is correct.
-
Go to CONTRIBUTING.md
Examples
- The following code sample shows how to rotate random points and compute the gradient of batched rotation.
>>> import torch, pypose as pp
>>> # A random so(3) LieTensor
>>> r = pp.randn_so3(2, requires_grad=True)
so3Type LieTensor:
tensor([[ 0.1606, 0.0232, -1.5516],
[-0.0807, -0.7184, -0.1102]], requires_grad=True)
>>> R = r.Exp() # Equivalent to: R = pp.Exp(r)
SO3Type LieTensor:
tensor([[ 0.0724, 0.0104, -0.6995, 0.7109],
[-0.0395, -0.3513, -0.0539, 0.9339]], grad_fn=<AliasBackward0>)
>>> p = R @ torch.randn(3) # Rotate random point
tensor([[ 0.8045, -0.8555, 0.5260],
[ 0.3502, 0.8337, 0.9154]], grad_fn=<ViewBackward0>)
>>> p.sum().backward() # Compute gradient
>>> r.grad # Print gradient
tensor([[-0.7920, -0.9510, 1.7110],
[-0.2659, 0.5709, -0.3855]])
- This example shows how to estimate batched inverse of transform by a second-order optimizer. Two usage options for a
schedulerare provided, each of which can work independently.
>>> from torch import nn
>>> import torch, pypose as pp
>>> from pypose.optim import LM
>>> from pypose.optim.strategy import Constant
>>> from pypose.optim.scheduler import StopOnPlateau
>>> class InvNet(nn.Module):
...
... def __init__(self, *dim):
... super().__init__()
... init = pp.randn_SE3(*dim)
... self.pose = pp.Parameter(init)
...
... def forward(self, input):
... error = (self.pose @ input).Log()
... return error.tensor()
>>> device = torch.device("cuda")
>>> input = pp.randn_SE3(2, 2, device=device)
>>> invnet = InvNet(2, 2).to(device)
>>> strategy = Constant(damping=1e-4)
>>> optimizer = LM(invnet, strategy=strategy)
>>> scheduler = StopOnPlateau(optimizer, steps=10, patience=3, decreasing=1e-3, verbose=True)
>>> # 1st option, full optimization
>>> scheduler.optimize(input=input)
>>> # 2nd option, step optimization
>>> while scheduler.continual():
... loss = optimizer.step(input)
... scheduler.step(loss)
>>> # Note: remove one of the above options for usage!
- May 2026: PyPose v0.9.5 integrates the sparse Jacobian tracing and sparse second-order optimization methods developed in Bundle Adjustment in the Eager Mode to accelerate applications such as bundle adjustment.
>>> import torch
>>> import pypose as pp
>>> from torch import nn
>>> from pypose.optim import LM
>>> from pypose.optim.solver import PCG
>>> from pypose.optim.strategy import TrustRegion
>>> from pypose.optim.scheduler import StopOnPlateau
>>> from pypose.autograd.function import psjac
>>> class ReprojErr(nn.Module):
... def __init__(self, poses, points):
... super().__init__()
... # sjac: enabling tracing of sparse Jacobian
... self.poses = pp.Parameter(poses, sjac=True)
... self.points = pp.Parameter(points, sjac=True)
...
... @psjac # parallelize assembly of sparse Jacobian
... def project(poses, points):
... points = poses.Act(points)
... return - points[..., :2] / points[..., [2]]
...
... def forward(self, pixels, cidx, pidx):
... poses = self.poses[cidx]
... points = self.points[pidx]
... return ReprojErr.project(poses, points) - pixels
>>> torch.set_default_device("cuda")
>>> npts, poses = 8, pp.randn_SE3(1)
>>> points = torch.randn(npts, 3)
>>> points[:, 2] += 4 # positive depth
>>> cidx = torch.zeros(npts, dtype=torch.long)
>>> pidx = torch.arange(npts)
>>> pixels = torch.randn(npts, 2)
>>> inputs = (pixels, cidx, pidx)
>>> model = ReprojErr(poses, points)
>>> solver = PCG(tol=1e-4, maxiter=250)
>>> strategy = TrustRegion(up=2.0, down=0.5**4)
>>> optimizer = LM(model, solver, strategy, sparse=True)
>>> scheduler = StopOnPlateau(optimizer, steps=5, verbose=True)
>>> while scheduler.continual():
... loss = optimizer.step(inputs)
... scheduler.step(loss)
For more usage, see Documentation. For more applications, see Examples.
Citing PyPose
If you use PyPose, please cite the papers below.
PyPose: A Library for Robot Learning with Physics-based Optimization
@inproceedings{wang2023pypose,
title = {{PyPose}: A Library for Robot Learning with Physics-based Optimization},
author = {Wang, Chen and Gao, Dasong and Xu, Kuan and Geng, Junyi and Hu, Yaoyu and Qiu, Yuheng and Li, Bowen and Yang, Fan and Moon, Brady and Pandey, Abhinav and Aryan and Xu, Jiahe and Wu, Tianhao and He, Haonan and Huang, Daning and Ren, Zhongqiang and Zhao, Shibo and Fu, Taimeng and Reddy, Pranay and Lin, Xiao and Wang, Wenshan and Shi, Jingnan and Talak, Rajat and Cao, Kun and Du, Yi and Wang, Han and Yu, Huai and Wang, Shanzhao and Chen, Siyu and Kashyap, Ananth and Bandaru, Rohan and Dantu, Karthik and Wu, Jiajun and Xie, Lihua and Carlone, Luca and Hutter, Marco and Scherer, Sebastian},
booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR)},
year = {2023}
}
Bundle Adjustment in the Eager Mode
@article{zhan2026bundle,
title = {Bundle Adjustment in the Eager Mode},
author = {Zhan, Zitong and Xu, Huan and Fang, Zihang and Wei, Xinpeng and Hu, Yaoyu and Wang, Chen},
journal = {IEEE Transactions on Robotics (T-RO)},
year = {2026},
url = {https://arxiv.org/abs/2409.12190}
}
PyPose v0.6: The Imperative Programming Interface for Robotics
@inproceedings{zhan2023pypose,
title = {{PyPose} v0.6: The Imperative Programming Interface for Robotics},
author = {Zitong Zhan and Xiangfu Li and Qihang Li and Haonan He and Abhinav Pandey and Haitao Xiao and Yangmengfei Xu and Xiangyu Chen and Kuan Xu and Kun Cao and Zhipeng Zhao and Zihan Wang and Huan Xu and Zihang Fang and Yutian Chen and Wentao Wang and Xu Fang and Yi Du and Tianhao Wu and Xiao Lin and Yuheng Qiu and Fan Yang and Jingnan Shi and Shaoshu Su and Yiren Lu and Taimeng Fu and Karthik Dantu and Jiajun Wu and Lihua Xie and Marco Hutter and Luca Carlone and Sebastian Scherer and Daning Huang and Yaoyu Hu and Junyi Geng and Chen Wang},
year = {2023},
booktitle = {IEEE/RSJ International Conference on Intelligent Robots and Systems (IROS) Workshop},
}
If you use the bundle adjustment or pose graph optimization functions, or its components such as sparse Jacobian, GPU sparse linear algebra, conjugate gradient solver, or sparse LM optimizer, you must cite Bundle Adjustment in the Eager Mode.
Point of Contact
For any questions, please contact @zitongzhan with a copy to @wang-chen.