Giter Site home page Giter Site logo

pypose / pypose Goto Github PK

View Code? Open in Web Editor NEW
1.2K 12.0 99.0 12.34 MB

A library for differentiable robotics.

Home Page: https://pypose.org

License: Apache License 2.0

Python 100.00%
robotics pytorch python learning lie-group optimization deep-learning computer-graphics geometric-deep-learning physics

pypose's Introduction

PyPose: A Library for Robot Learning with Physics-based Optimization

robot


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

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.

image

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

  1. Requirement:

On Ubuntu, macOS, or Windows, install PyTorch, then run:

pip install -r requirements/runtime.txt
  1. Install locally:
git clone  https://github.com/pypose/pypose.git
cd pypose && python setup.py develop
  1. Run tests
pytest

For contributors

  1. Make sure the above installation is correct.

  2. Go to CONTRIBUTING.md

Examples

  1. 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]])
  1. This example shows how to estimate batched inverse of transform by a second-order optimizer. Two usage options for a scheduler are 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!

For more usage, see Documentation. For more applications, see Examples.

Citing PyPose

If you use PyPose, please cite the paper below. You may also download it here.

@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}
}

More papers describing PyPose:

@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},
}

pypose's People

Contributors

aakashyap1 avatar aerogjy avatar apandey02 avatar aryanmangal769 avatar balisujohn avatar bradygm avatar futaimeng avatar hakunanh avatar haleqiu avatar honglouyemeng avatar huyaoyu avatar hxu296 avatar jaraxxus-me avatar jingnanshi avatar lx017 avatar markchenyutian avatar parth4git avatar pranay-ar avatar qinhanhahaha avatar rohan2017 avatar rokeeeto-li avatar saakshii12 avatar sh4d0wy avatar shanzhaowang99 avatar smanist avatar wang-chen avatar xanthorapedia avatar xukuanhit avatar xyc0212 avatar zitongzhan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pypose's Issues

identity_RxSO3 and identity_rxso3 not implemented

Summary

identity_RxSO3 and identity_rxso3 not implemented

Steps to reproduce

>>> X = pp.identity_RxSO3()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/yuhengq/workspace/pypose/pypose/lietensor/utils.py", line 820, in identity_RxSO3
    return RxSO3_type.identity(*size, **kwargs)
  File "/home/yuhengq/workspace/pypose/pypose/lietensor/lietensor.py", line 345, in identity
    return LieTensor(data.expand(size+(-1,)), ltype=rxso3_type)
  File "/home/yuhengq/workspace/pypose/pypose/lietensor/lietensor.py", line 513, in __init__
    assert self.shape[-1:] == ltype.dimension, 'Dimension Invalid. Go to{}'.format(
AssertionError: Dimension Invalid. Go tohttps://pypose.org/docs/generated/pypose.LieTensor/#pypose.LieTensor
>>> X = pp.identity_rxso3()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/yuhengq/workspace/pypose/pypose/lietensor/utils.py", line 816, in identity_rxso3
    return rxso3_type.identity(*size, **kwargs)
  File "/home/yuhengq/workspace/pypose/pypose/lietensor/lietensor.py", line 362, in identity
    return RxSO3_type.Log(RxSO3_type.identity(*size, **kwargs))
  File "/home/yuhengq/workspace/pypose/pypose/lietensor/lietensor.py", line 345, in identity
    return LieTensor(data.expand(size+(-1,)), ltype=rxso3_type)
  File "/home/yuhengq/workspace/pypose/pypose/lietensor/lietensor.py", line 513, in __init__
    assert self.shape[-1:] == ltype.dimension, 'Dimension Invalid. Go to{}'.format(
AssertionError: Dimension Invalid. Go tohttps://pypose.org/docs/generated/pypose.LieTensor/#pypose.LieTensor

left and right products of cumprod

Summary

The doc of pp.cumprod is incorrect. Current setup only supports left product, while our doc indicates that weโ€™re doing right product.

Improvement

Add a bool type to determine the mod of cumprod.

Uniformly sample rotations.

Problem to solve

  • Sampling uniformly over the space of rotations is often needed for robotic planning.
  • Thus possible interfaces can be rand_SO3, rand_SE3, rand_Sim3, rand_RxSO3.
  • The Haar distribution may be useful for this purpose.

error when install pypose: /torch/include/torch/csrc/api/include/torch/nn/cloneable.h:57:59: error

When I follow your instruction to install pypyose, I meet the error:

[with Derived = torch::nn::CrossMapLRN2dImpl]โ€™: /tmp/tmpxft_0000d2f7_00000000-6_basis_cuda.cudafe1.stub.c:51:27: required from here /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:57:59: error: invalid static_cast from type โ€˜const torch::OrderedDict<std::basic_string, at::Tensor>โ€™ to type โ€˜torch::OrderedDict<std::basic_string, at::Tensor>&โ€™ /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:69:61: error: invalid static_cast from type โ€˜const torch::OrderedDict<std::basic_string, std::shared_ptrtorch::nn::Module >โ€™ to type โ€˜torch::OrderedDict<std::basic_string, std::shared_ptrtorch::nn::Module >&โ€™ /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h: In instantiation of โ€˜std::shared_ptrtorch::nn::Module torch::nn::Cloneable::clone(const c10::optionalc10::Device&) const [with Derived = torch::nn::EmbeddingBagImpl]โ€™: /tmp/tmpxft_0000d2f7_00000000-6_basis_cuda.cudafe1.stub.c:51:27: required from here /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:57:59: error: invalid static_cast from type โ€˜const torch::OrderedDict<std::basic_string, at::Tensor>โ€™ to type โ€˜torch::OrderedDict<std::basic_string, at::Tensor>&โ€™ /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:69:61: error: invalid static_cast from type โ€˜const torch::OrderedDict<std::basic_string, std::shared_ptrtorch::nn::Module >โ€™ to type โ€˜torch::OrderedDict<std::basic_string, std::shared_ptrtorch::nn::Module >&โ€™ /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h: In instantiation of โ€˜std::shared_ptrtorch::nn::Module torch::nn::Cloneable::clone(const c10::optionalc10::Device&) const [with Derived = torch::nn::EmbeddingImpl]โ€™: /tmp/tmpxft_0000d2f7_00000000-6_basis_cuda.cudafe1.stub.c:51:27: required from here /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:57:59: error: invalid static_cast from type โ€˜const torch::OrderedDict<std::basic_string, at::Tensor>โ€™ to type โ€˜torch::OrderedDict<std::basic_string, at::Tensor>&โ€™ /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:69:61: error: invalid static_cast from type โ€˜const torch::OrderedDict<std::basic_string, std::shared_ptrtorch::nn::Module >โ€™ to type โ€˜torch::OrderedDict<std::basic_string, std::shared_ptrtorch::nn::Module >&โ€™ /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h: In instantiation of โ€˜std::shared_ptrtorch::nn::Module torch::nn::Cloneable::clone(const c10::optionalc10::Device&) const [with Derived = torch::nn::ParameterDictImpl]โ€™: /tmp/tmpxft_0000d2f7_00000000-6_basis_cuda.cudafe1.stub.c:51:27: required from here /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:57:59: error: invalid static_cast from type โ€˜const torch::OrderedDict<std::basic_string, at::Tensor>โ€™ to type โ€˜torch::OrderedDict<std::basic_string, at::Tensor>&โ€™ /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:69:61: error: invalid static_cast from type โ€˜const torch::OrderedDict<std::basic_string, std::shared_ptrtorch::nn::Module >โ€™ to type โ€˜torch::OrderedDict<std::basic_string, std::shared_ptrtorch::nn::Module >&โ€™ /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h: In instantiation of โ€˜std::shared_ptrtorch::nn::Module torch::nn::Cloneable::clone(const c10::optionalc10::Device&) const [with Derived = torch::nn::SequentialImpl]โ€™: /tmp/tmpxft_0000d2f7_00000000-6_basis_cuda.cudafe1.stub.c:51:27: required from here /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:57:59: error: invalid static_cast from type โ€˜const torch::OrderedDict<std::basic_string, at::Tensor>โ€™ to type โ€˜torch::OrderedDict<std::basic_string, at::Tensor>&โ€™ /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:69:61: error: invalid static_cast from type โ€˜const torch::OrderedDict<std::basic_string, std::shared_ptrtorch::nn::Module >โ€™ to type โ€˜torch::OrderedDict<std::basic_string, std::shared_ptrtorch::nn::Module >&โ€™ /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h: In instantiation of โ€˜std::shared_ptrtorch::nn::Module torch::nn::Cloneable::clone(const c10::optionalc10::Device&) const [with Derived = torch::nn::ModuleListImpl]โ€™: /tmp/tmpxft_0000d2f7_00000000-6_basis_cuda.cudafe1.stub.c:51:27: required from here /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:57:59: error: invalid static_cast from type โ€˜const torch::OrderedDict<std::basic_string, at::Tensor>โ€™ to type โ€˜torch::OrderedDict<std::basic_string, at::Tensor>&โ€™ /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:69:61: error: invalid static_cast from type โ€˜const torch::OrderedDict<std::basic_string, std::shared_ptrtorch::nn::Module >โ€™ to type โ€˜torch::OrderedDict<std::basic_string, std::shared_ptrtorch::nn::Module >&โ€™ /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h: In instantiation of โ€˜std::shared_ptrtorch::nn::Module torch::nn::Cloneable::clone(const c10::optionalc10::Device&) const [with Derived = torch::nn::ModuleDictImpl]โ€™: /tmp/tmpxft_0000d2f7_00000000-6_basis_cuda.cudafe1.stub.c:51:27: required from here /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:57:59: error: invalid static_cast from type โ€˜const torch::OrderedDict<std::basic_string, at::Tensor>โ€™ to type โ€˜torch::OrderedDict<std::basic_string, at::Tensor>&โ€™ /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:69:61: error: invalid static_cast from type โ€˜const torch::OrderedDict<std::basic_string, std::shared_ptrtorch::nn::Module >โ€™ to type โ€˜torch::OrderedDict<std::basic_string, std::shared_ptrtorch::nn::Module >&โ€™ /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h: In instantiation of โ€˜std::shared_ptrtorch::nn::Module torch::nn::Cloneable::clone(const c10::optionalc10::Device&) const [with Derived = torch::nn::TransformerDecoderImpl]โ€™: /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/optim/sgd.h:49:48: required from here /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:57:59: error: invalid static_cast from type โ€˜const torch::OrderedDict<std::basic_string, at::Tensor>โ€™ to type โ€˜torch::OrderedDict<std::basic_string, at::Tensor>&โ€™ /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:69:61: error: invalid static_cast from type โ€˜const torch::OrderedDict<std::basic_string, std::shared_ptrtorch::nn::Module >โ€™ to type โ€˜torch::OrderedDict<std::basic_string, std::shared_ptrtorch::nn::Module >&โ€™ /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h: In instantiation of โ€˜std::shared_ptrtorch::nn::Module torch::nn::Cloneable::clone(const c10::optionalc10::Device&) const [with Derived = torch::nn::TransformerEncoderImpl]โ€™: /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/optim/sgd.h:49:48: required from here /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:57:59: error: invalid static_cast from type โ€˜const torch::OrderedDict<std::basic_string, at::Tensor>โ€™ to type โ€˜torch::OrderedDict<std::basic_string, at::Tensor>&โ€™ /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:69:61: error: invalid static_cast from type โ€˜const torch::OrderedDict<std::basic_string, std::shared_ptrtorch::nn::Module >โ€™ to type โ€˜torch::OrderedDict<std::basic_string, std::shared_ptrtorch::nn::Module >&โ€™ /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h: In instantiation of โ€˜std::shared_ptrtorch::nn::Module torch::nn::Cloneable::clone(const c10::optionalc10::Device&) const [with Derived = torch::nn::TransformerDecoderLayerImpl]โ€™: /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/optim/sgd.h:49:48: required from here /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:57:59: error: invalid static_cast from type โ€˜const torch::OrderedDict<std::basic_string, at::Tensor>โ€™ to type โ€˜torch::OrderedDict<std::basic_string, at::Tensor>&โ€™ /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:69:61: error: invalid static_cast from type โ€˜const torch::OrderedDict<std::basic_string, std::shared_ptrtorch::nn::Module >โ€™ to type โ€˜torch::OrderedDict<std::basic_string, std::shared_ptrtorch::nn::Module >&โ€™ /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h: In instantiation of โ€˜std::shared_ptrtorch::nn::Module torch::nn::Cloneable::clone(const c10::optionalc10::Device&) const [with Derived = torch::nn::TransformerEncoderLayerImpl]โ€™: /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/optim/sgd.h:49:48: required from here /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:57:59: error: invalid static_cast from type โ€˜const torch::OrderedDict<std::basic_string, at::Tensor>โ€™ to type โ€˜torch::OrderedDict<std::basic_string, at::Tensor>&โ€™ /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:69:61: error: invalid static_cast from type โ€˜const torch::OrderedDict<std::basic_string, std::shared_ptrtorch::nn::Module >โ€™ to type โ€˜torch::OrderedDict<std::basic_string, std::shared_ptrtorch::nn::Module >&โ€™ /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h: In instantiation of โ€˜std::shared_ptrtorch::nn::Module torch::nn::Cloneable::clone(const c10::optionalc10::Device&) const [with Derived = torch::nn::GroupNormImpl]โ€™: /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/optim/sgd.h:49:48: required from here /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:57:59: error: invalid static_cast from type โ€˜const torch::OrderedDict<std::basic_string, at::Tensor>โ€™ to type โ€˜torch::OrderedDict<std::basic_string, at::Tensor>&โ€™ /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:69:61: error: invalid static_cast from type โ€˜const torch::OrderedDict<std::basic_string, std::shared_ptrtorch::nn::Module >โ€™ to type โ€˜torch::OrderedDict<std::basic_string, std::shared_ptrtorch::nn::Module >&โ€™ /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h: In instantiation of โ€˜std::shared_ptrtorch::nn::Module torch::nn::Cloneable::clone(const c10::optionalc10::Device&) const [with Derived = torch::nn::LocalResponseNormImpl]โ€™: /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/optim/sgd.h:49:48: required from here /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:57:59: error: invalid static_cast from type โ€˜const torch::OrderedDict<std::basic_string, at::Tensor>โ€™ to type โ€˜torch::OrderedDict<std::basic_string, at::Tensor>&โ€™ /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:69:61: error: invalid static_cast from type โ€˜const torch::OrderedDict<std::basic_string, std::shared_ptrtorch::nn::Module >โ€™ to type โ€˜torch::OrderedDict<std::basic_string, std::shared_ptrtorch::nn::Module >&โ€™ /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h: In instantiation of โ€˜std::shared_ptrtorch::nn::Module torch::nn::Cloneable::clone(const c10::optionalc10::Device&) const [with Derived = torch::nn::LayerNormImpl]โ€™: /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/optim/sgd.h:49:48: required from here /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:57:59: error: invalid static_cast from type โ€˜const torch::OrderedDict<std::basic_string, at::Tensor>โ€™ to type โ€˜torch::OrderedDict<std::basic_string, at::Tensor>&โ€™ /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:69:61: error: invalid static_cast from type โ€˜const torch::OrderedDict<std::basic_string, std::shared_ptrtorch::nn::Module >โ€™ to type โ€˜torch::OrderedDict<std::basic_string, std::shared_ptrtorch::nn::Module >&โ€™ /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h: In instantiation of โ€˜std::shared_ptrtorch::nn::Module torch::nn::Cloneable::clone(const c10::optionalc10::Device&) const [with Derived = torch::nn::MultiheadAttentionImpl]โ€™: /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/optim/sgd.h:49:48: required from here /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:57:59: error: invalid static_cast from type โ€˜const torch::OrderedDict<std::basic_string, at::Tensor>โ€™ to type โ€˜torch::OrderedDict<std::basic_string, at::Tensor>&โ€™ /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:69:61: error: invalid static_cast from type โ€˜const torch::OrderedDict<std::basic_string, std::shared_ptrtorch::nn::Module >โ€™ to type โ€˜torch::OrderedDict<std::basic_string, std::shared_ptrtorch::nn::Module >&โ€™ /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h: In instantiation of โ€˜std::shared_ptrtorch::nn::Module torch::nn::Cloneable::clone(const c10::optionalc10::Device&) const [with Derived = torch::nn::ThresholdImpl]โ€™: /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/optim/sgd.h:49:48: required from here /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:57:59: error: invalid static_cast from type โ€˜const torch::OrderedDict<std::basic_string, at::Tensor>โ€™ to type โ€˜torch::OrderedDict<std::basic_string, at::Tensor>&โ€™ /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:69:61: error: invalid static_cast from type โ€˜const torch::OrderedDict<std::basic_string, std::shared_ptrtorch::nn::Module >โ€™ to type โ€˜torch::OrderedDict<std::basic_string, std::shared_ptrtorch::nn::Module >&โ€™ /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h: In instantiation of โ€˜std::shared_ptrtorch::nn::Module torch::nn::Cloneable::clone(const c10::optionalc10::Device&) const [with Derived = torch::nn::LogSoftmaxImpl]โ€™: /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/optim/sgd.h:49:48: required from here /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:57:59: error: invalid static_cast from type โ€˜const torch::OrderedDict<std::basic_string, at::Tensor>โ€™ to type โ€˜torch::OrderedDict<std::basic_string, at::Tensor>&โ€™ /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:69:61: error: invalid static_cast from type โ€˜const torch::OrderedDict<std::basic_string, std::shared_ptrtorch::nn::Module >โ€™ to type โ€˜torch::OrderedDict<std::basic_string, std::shared_ptrtorch::nn::Module >&โ€™ /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h: In instantiation of โ€˜std::shared_ptrtorch::nn::Module torch::nn::Cloneable::clone(const c10::optionalc10::Device&) const [with Derived = torch::nn::SoftminImpl]โ€™: /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/optim/sgd.h:49:48: required from here /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:57:59: error: invalid static_cast from type โ€˜const torch::OrderedDict<std::basic_string, at::Tensor>โ€™ to type โ€˜torch::OrderedDict<std::basic_string, at::Tensor>&โ€™ /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:69:61: error: invalid static_cast from type โ€˜const torch::OrderedDict<std::basic_string, std::shared_ptrtorch::nn::Module >โ€™ to type โ€˜torch::OrderedDict<std::basic_string, std::shared_ptrtorch::nn::Module >&โ€™ /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h: In instantiation of โ€˜std::shared_ptrtorch::nn::Module torch::nn::Cloneable::clone(const c10::optionalc10::Device&) const [with Derived = torch::nn::SoftmaxImpl]โ€™: /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/optim/sgd.h:49:48: required from here /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:57:59: error: invalid static_cast from type โ€˜const torch::OrderedDict<std::basic_string, at::Tensor>โ€™ to type โ€˜torch::OrderedDict<std::basic_string, at::Tensor>&โ€™ /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:69:61: error: invalid static_cast from type โ€˜const torch::OrderedDict<std::basic_string, std::shared_ptrtorch::nn::Module >โ€™ to type โ€˜torch::OrderedDict<std::basic_string, std::shared_ptrtorch::nn::Module >&โ€™ /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h: In instantiation of โ€˜std::shared_ptrtorch::nn::Module torch::nn::Cloneable::clone(const c10::optionalc10::Device&) const [with Derived = torch::nn::GRUCellImpl]โ€™: /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/optim/sgd.h:49:48: required from here /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:57:59: error: invalid static_cast from type โ€˜const torch::OrderedDict<std::basic_string, at::Tensor>โ€™ to type โ€˜torch::OrderedDict<std::basic_string, at::Tensor>&โ€™ /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:69:61: error: invalid static_cast from type โ€˜const torch::OrderedDict<std::basic_string, std::shared_ptrtorch::nn::Module >โ€™ to type โ€˜torch::OrderedDict<std::basic_string, std::shared_ptrtorch::nn::Module >&โ€™ /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h: In instantiation of โ€˜std::shared_ptrtorch::nn::Module torch::nn::Cloneable::clone(const c10::optionalc10::Device&) const [with Derived = torch::nn::LSTMCellImpl]โ€™: /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/optim/sgd.h:49:48: required from here /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:57:59: error: invalid static_cast from type โ€˜const torch::OrderedDict<std::basic_string, at::Tensor>โ€™ to type โ€˜torch::OrderedDict<std::basic_string, at::Tensor>&โ€™ /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:69:61: error: invalid static_cast from type โ€˜const torch::OrderedDict<std::basic_string, std::shared_ptrtorch::nn::Module >โ€™ to type โ€˜torch::OrderedDict<std::basic_string, std::shared_ptrtorch::nn::Module >&โ€™ /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h: In instantiation of โ€˜std::shared_ptrtorch::nn::Module torch::nn::Cloneable::clone(const c10::optionalc10::Device&) const [with Derived = torch::nn::RNNCellImpl]โ€™: /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/optim/sgd.h:49:48: required from here /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:57:59: error: invalid static_cast from type โ€˜const torch::OrderedDict<std::basic_string, at::Tensor>โ€™ to type โ€˜torch::OrderedDict<std::basic_string, at::Tensor>&โ€™ /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:69:61: error: invalid static_cast from type โ€˜const torch::OrderedDict<std::basic_string, std::shared_ptrtorch::nn::Module >โ€™ to type โ€˜torch::OrderedDict<std::basic_string, std::shared_ptrtorch::nn::Module >&โ€™ /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h: In instantiation of โ€˜std::shared_ptrtorch::nn::Module torch::nn::Cloneable::clone(const c10::optionalc10::Device&) const [with Derived = torch::nn::GRUImpl]โ€™: /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/optim/sgd.h:49:48: required from here /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:57:59: error: invalid static_cast from type โ€˜const torch::OrderedDict<std::basic_string, at::Tensor>โ€™ to type โ€˜torch::OrderedDict<std::basic_string, at::Tensor>&โ€™ /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:69:61: error: invalid static_cast from type โ€˜const torch::OrderedDict<std::basic_string, std::shared_ptrtorch::nn::Module >โ€™ to type โ€˜torch::OrderedDict<std::basic_string, std::shared_ptrtorch::nn::Module >&โ€™ /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h: In instantiation of โ€˜std::shared_ptrtorch::nn::Module torch::nn::Cloneable::clone(const c10::optionalc10::Device&) const [with Derived = torch::nn::LSTMImpl]โ€™: /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/optim/sgd.h:49:48: required from here /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:57:59: error: invalid static_cast from type โ€˜const torch::OrderedDict<std::basic_string, at::Tensor>โ€™ to type โ€˜torch::OrderedDict<std::basic_string, at::Tensor>&โ€™ /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:69:61: error: invalid static_cast from type โ€˜const torch::OrderedDict<std::basic_string, std::shared_ptrtorch::nn::Module >โ€™ to type โ€˜torch::OrderedDict<std::basic_string, std::shared_ptrtorch::nn::Module >&โ€™ /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h: In instantiation of โ€˜std::shared_ptrtorch::nn::Module torch::nn::Cloneable::clone(const c10::optionalc10::Device&) const [with Derived = torch::nn::RNNImpl]โ€™: /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/optim/sgd.h:49:48: required from here /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:57:59: error: invalid static_cast from type โ€˜const torch::OrderedDict<std::basic_string, at::Tensor>โ€™ to type โ€˜torch::OrderedDict<std::basic_string, at::Tensor>&โ€™ /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:69:61: error: invalid static_cast from type โ€˜const torch::OrderedDict<std::basic_string, std::shared_ptrtorch::nn::Module >โ€™ to type โ€˜torch::OrderedDict<std::basic_string, std::shared_ptrtorch::nn::Module >&โ€™ /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h: In instantiation of โ€˜std::shared_ptrtorch::nn::Module torch::nn::Cloneable::clone(const c10::optionalc10::Device&) const [with Derived = torch::nn::FractionalMaxPool3dImpl]โ€™: /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/optim/sgd.h:49:48: required from here /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:57:59: error: invalid static_cast from type โ€˜const torch::OrderedDict<std::basic_string, at::Tensor>โ€™ to type โ€˜torch::OrderedDict<std::basic_string, at::Tensor>&โ€™ /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:69:61: error: invalid static_cast from type โ€˜const torch::OrderedDict<std::basic_string, std::shared_ptrtorch::nn::Module >โ€™ to type โ€˜torch::OrderedDict<std::basic_string, std::shared_ptrtorch::nn::Module >&โ€™ /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h: In instantiation of โ€˜std::shared_ptrtorch::nn::Module torch::nn::Cloneable::clone(const c10::optionalc10::Device&) const [with Derived = torch::nn::FractionalMaxPool2dImpl]โ€™: /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/optim/sgd.h:49:48: required from here /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:57:59: error: invalid static_cast from type โ€˜const torch::OrderedDict<std::basic_string, at::Tensor>โ€™ to type โ€˜torch::OrderedDict<std::basic_string, at::Tensor>&โ€™ /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:69:61: error: invalid static_cast from type โ€˜const torch::OrderedDict<std::basic_string, std::shared_ptrtorch::nn::Module >โ€™ to type โ€˜torch::OrderedDict<std::basic_string, std::shared_ptrtorch::nn::Module >&โ€™ /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h: In instantiation of โ€˜std::shared_ptrtorch::nn::Module torch::nn::Cloneable::clone(const c10::optionalc10::Device&) const [with Derived = torch::nn::ZeroPad2dImpl]โ€™: /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/optim/sgd.h:49:48: required from here /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:57:59: error: invalid static_cast from type โ€˜const torch::OrderedDict<std::basic_string, at::Tensor>โ€™ to type โ€˜torch::OrderedDict<std::basic_string, at::Tensor>&โ€™ /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:69:61: error: invalid static_cast from type โ€˜const torch::OrderedDict<std::basic_string, std::shared_ptrtorch::nn::Module >โ€™ to type โ€˜torch::OrderedDict<std::basic_string, std::shared_ptrtorch::nn::Module >&โ€™ /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h: In instantiation of โ€˜std::shared_ptrtorch::nn::Module torch::nn::Cloneable::clone(const c10::optionalc10::Device&) const [with Derived = torch::nn::UnfoldImpl]โ€™: /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/optim/sgd.h:49:48: required from here /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:57:59: error: invalid static_cast from type โ€˜const torch::OrderedDict<std::basic_string, at::Tensor>โ€™ to type โ€˜torch::OrderedDict<std::basic_string, at::Tensor>&โ€™ /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:69:61: error: invalid static_cast from type โ€˜const torch::OrderedDict<std::basic_string, std::shared_ptrtorch::nn::Module >โ€™ to type โ€˜torch::OrderedDict<std::basic_string, std::shared_ptrtorch::nn::Module >&โ€™ /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h: In instantiation of โ€˜std::shared_ptrtorch::nn::Module torch::nn::Cloneable::clone(const c10::optionalc10::Device&) const [with Derived = torch::nn::FoldImpl]โ€™: /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/optim/sgd.h:49:48: required from here /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:57:59: error: invalid static_cast from type โ€˜const torch::OrderedDict<std::basic_string, at::Tensor>โ€™ to type โ€˜torch::OrderedDict<std::basic_string, at::Tensor>&โ€™ /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:69:61: error: invalid static_cast from type โ€˜const torch::OrderedDict<std::basic_string, std::shared_ptrtorch::nn::Module >โ€™ to type โ€˜torch::OrderedDict<std::basic_string, std::shared_ptrtorch::nn::Module >&โ€™ /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h: In instantiation of โ€˜std::shared_ptrtorch::nn::Module torch::nn::Cloneable::clone(const c10::optionalc10::Device&) const [with Derived = torch::nn::ConvTranspose3dImpl]โ€™: /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/optim/sgd.h:49:48: required from here /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:57:59: error: invalid static_cast from type โ€˜const torch::OrderedDict<std::basic_string, at::Tensor>โ€™ to type โ€˜torch::OrderedDict<std::basic_string, at::Tensor>&โ€™ /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:69:61: error: invalid static_cast from type โ€˜const torch::OrderedDict<std::basic_string, std::shared_ptrtorch::nn::Module >โ€™ to type โ€˜torch::OrderedDict<std::basic_string, std::shared_ptrtorch::nn::Module >&โ€™ /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h: In instantiation of โ€˜std::shared_ptrtorch::nn::Module torch::nn::Cloneable::clone(const c10::optionalc10::Device&) const [with Derived = torch::nn::ConvTranspose2dImpl]โ€™: /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/optim/sgd.h:49:48: required from here /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:57:59: error: invalid static_cast from type โ€˜const torch::OrderedDict<std::basic_string, at::Tensor>โ€™ to type โ€˜torch::OrderedDict<std::basic_string, at::Tensor>&โ€™ /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:69:61: error: invalid static_cast from type โ€˜const torch::OrderedDict<std::basic_string, std::shared_ptrtorch::nn::Module >โ€™ to type โ€˜torch::OrderedDict<std::basic_string, std::shared_ptrtorch::nn::Module >&โ€™ /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h: In instantiation of โ€˜std::shared_ptrtorch::nn::Module torch::nn::Cloneable::clone(const c10::optionalc10::Device&) const [with Derived = torch::nn::ConvTranspose1dImpl]โ€™: /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/optim/sgd.h:49:48: required from here /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:57:59: error: invalid static_cast from type โ€˜const torch::OrderedDict<std::basic_string, at::Tensor>โ€™ to type โ€˜torch::OrderedDict<std::basic_string, at::Tensor>&โ€™ /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:69:61: error: invalid static_cast from type โ€˜const torch::OrderedDict<std::basic_string, std::shared_ptrtorch::nn::Module >โ€™ to type โ€˜torch::OrderedDict<std::basic_string, std::shared_ptrtorch::nn::Module >&โ€™ /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h: In instantiation of โ€˜std::shared_ptrtorch::nn::Module torch::nn::Cloneable::clone(const c10::optionalc10::Device&) const [with Derived = torch::nn::Conv3dImpl]โ€™: /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/optim/sgd.h:49:48: required from here /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:57:59: error: invalid static_cast from type โ€˜const torch::OrderedDict<std::basic_string, at::Tensor>โ€™ to type โ€˜torch::OrderedDict<std::basic_string, at::Tensor>&โ€™ /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:69:61: error: invalid static_cast from type โ€˜const torch::OrderedDict<std::basic_string, std::shared_ptrtorch::nn::Module >โ€™ to type โ€˜torch::OrderedDict<std::basic_string, std::shared_ptrtorch::nn::Module >&โ€™ /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h: In instantiation of โ€˜std::shared_ptrtorch::nn::Module torch::nn::Cloneable::clone(const c10::optionalc10::Device&) const [with Derived = torch::nn::Conv2dImpl]โ€™: /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/optim/sgd.h:49:48: required from here /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:57:59: error: invalid static_cast from type โ€˜const torch::OrderedDict<std::basic_string, at::Tensor>โ€™ to type โ€˜torch::OrderedDict<std::basic_string, at::Tensor>&โ€™ /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:69:61: error: invalid static_cast from type โ€˜const torch::OrderedDict<std::basic_string, std::shared_ptrtorch::nn::Module >โ€™ to type โ€˜torch::OrderedDict<std::basic_string, std::shared_ptrtorch::nn::Module >&โ€™ /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h: In instantiation of โ€˜std::shared_ptrtorch::nn::Module torch::nn::Cloneable::clone(const c10::optionalc10::Device&) const [with Derived = torch::nn::Conv1dImpl]โ€™: /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/optim/sgd.h:49:48: required from here /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:57:59: error: invalid static_cast from type โ€˜const torch::OrderedDict<std::basic_string, at::Tensor>โ€™ to type โ€˜torch::OrderedDict<std::basic_string, at::Tensor>&โ€™ /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:69:61: error: invalid static_cast from type โ€˜const torch::OrderedDict<std::basic_string, std::shared_ptrtorch::nn::Module >โ€™ to type โ€˜torch::OrderedDict<std::basic_string, std::shared_ptrtorch::nn::Module >&โ€™ /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h: In instantiation of โ€˜std::shared_ptrtorch::nn::Module torch::nn::Cloneable::clone(const c10::optionalc10::Device&) const [with Derived = torch::nn::AdaptiveLogSoftmaxWithLossImpl]โ€™: /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/optim/sgd.h:49:48: required from here /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:57:59: error: invalid static_cast from type โ€˜const torch::OrderedDict<std::basic_string, at::Tensor>โ€™ to type โ€˜torch::OrderedDict<std::basic_string, at::Tensor>&โ€™ /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:69:61: error: invalid static_cast from type โ€˜const torch::OrderedDict<std::basic_string, std::shared_ptrtorch::nn::Module >โ€™ to type โ€˜torch::OrderedDict<std::basic_string, std::shared_ptrtorch::nn::Module >&โ€™ /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h: In instantiation of โ€˜std::shared_ptrtorch::nn::Module torch::nn::Cloneable::clone(const c10::optionalc10::Device&) const [with Derived = torch::nn::BilinearImpl]โ€™: /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/optim/sgd.h:49:48: required from here /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:57:59: error: invalid static_cast from type โ€˜const torch::OrderedDict<std::basic_string, at::Tensor>โ€™ to type โ€˜torch::OrderedDict<std::basic_string, at::Tensor>&โ€™ /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:69:61: error: invalid static_cast from type โ€˜const torch::OrderedDict<std::basic_string, std::shared_ptrtorch::nn::Module >โ€™ to type โ€˜torch::OrderedDict<std::basic_string, std::shared_ptrtorch::nn::Module >&โ€™ /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h: In instantiation of โ€˜std::shared_ptrtorch::nn::Module torch::nn::Cloneable::clone(const c10::optionalc10::Device&) const [with Derived = torch::nn::UnflattenImpl]โ€™: /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/optim/sgd.h:49:48: required from here /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:57:59: error: invalid static_cast from type โ€˜const torch::OrderedDict<std::basic_string, at::Tensor>โ€™ to type โ€˜torch::OrderedDict<std::basic_string, at::Tensor>&โ€™ /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:69:61: error: invalid static_cast from type โ€˜const torch::OrderedDict<std::basic_string, std::shared_ptrtorch::nn::Module >โ€™ to type โ€˜torch::OrderedDict<std::basic_string, std::shared_ptrtorch::nn::Module >&โ€™ /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h: In instantiation of โ€˜std::shared_ptrtorch::nn::Module torch::nn::Cloneable::clone(const c10::optionalc10::Device&) const [with Derived = torch::nn::LinearImpl]โ€™: /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/optim/sgd.h:49:48: required from here /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:57:59: error: invalid static_cast from type โ€˜const torch::OrderedDict<std::basic_string, at::Tensor>โ€™ to type โ€˜torch::OrderedDict<std::basic_string, at::Tensor>&โ€™ /disk1/zsxm/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:69:61: error: invalid static_cast from type โ€˜const torch::OrderedDict<std::basic_string, std::shared_ptrtorch::nn::Module >โ€™ to type โ€˜torch::OrderedDict<std::basic_string, std::shared_ptrtorch::nn::Module >&โ€™ error: command '/disk1/zsxm/cuda/cuda-11.3/bin/nvcc' failed with exit code 1 ---------------------------------------- ERROR: Command errored out with exit status 1: /disk1/zsxm/miniconda3/envs/pytorch/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-v6u5z4qm/torch-spline-conv_e33361d5a62a42fc81d0798373434c81/setup.py'"'"'; file='"'"'/tmp/pip-install-v6u5z4qm/torch-spline-conv_e33361d5a62a42fc81d0798373434c81/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(file) if os.path.exists(file) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record /tmp/pip-record-0ejz4nxt/install-record.txt --single-version-externally-managed --compile --install-headers /disk1/zsxm/miniconda3/envs/pytorch/include/python3.7m/torch-spline-conv Check the logs for full command output.

add Module ICP

Add a module for ICP.
It should work for batched point clouds and easy to extend for variant of ICP.

PyTorch implementation for LieTensor operation

To use any order differentiation for LieTensor operations, reimplement LieTensor operations including:

  • Exp for so3
  • Log for SO3
  • Exp for se3
  • Log for SE3
  • Exp for sim3
  • Log for Sim3
  • Exp for rxso3
  • Log for RxSO3
  • Inv
  • Retr
  • Act
  • Adj
  • AdjT
  • Jinvp
  • Jr

Extract a subset of LieTensor from another LieTensor

Problem to solve

Extract so3 part from sim3, so3 part from se3, etc (same thing for SO3, SE3, Sim3)

Further details

For example, when testing the Jacobian computation of RxSO3, one would like to extract the SO3 part of the corresponding Lie tensor and compute the Jacobian just for that. Since the closed-form solution of the Jacobian for RxSO3 is known, which is a block matrix consisting of that for SO3 part, one can use this as a way to debug it.

Proposal

unknown yet

Documentation

General Doc string
Args: input (LiTensor)
Return:
LieTensor: the output LieTensor

Testing

This extraction should't modify the original Lie tensor.

add optimization for Lie Group parameters

Problem to solve

The current implementation of optimizers only works for Lie Algebra, e.g., in this example.
This is because PyTorch optimizer like SGD calls function add_ to alter parameters, while simple addition doesn't work for Lie Groups. Making all LieTensor work with all PyTorch oprimizers would be necessary.

Proposal

Add LieTensor methods add add_ and __add__ that work for their physical meanings for Lie Group types can solve this issue.

remove cuda extension and eigen submodule

๐Ÿš€ The feature, motivation and pitch

Current implementation already supports pure PyTorch without CUDA extension. Remove the cuda extension and eigen submodule and make pip install easier.

Alternatives

No response

Additional context

No response

Doc for Inv

Problem to solve

  • Full Documentation of pypose.Inv for following LieTensor types.
  • SO3
  • SE3
  • Sim3
  • RxSO3
  • so3
  • se3
  • sim3
  • rxso3

vec2skew error with cuda

Summary

vec2skew used in Jr does not support cuda

Steps to reproduce

a = pp.randn_so3().to("cuda:0")
a.Jr()

What is the current bug behavior?

(What actually happens)

File ~/workspace/pypose/pypose/lietensor/lietensor.py:256, in so3Type.Jr(self, x)
250 def Jr(self, x):
251 """
252 Right jacobian of so(3)
253 The code is taken from the Sophus codebase :
254 https://github.com/XueLianjie/BA_schur/blob/3af9a94248d4a272c53cfc7acccea4d0208b77f7/thirdparty/Sophus/sophus/so3.hpp#L113
255 """
--> 256 K = vec2skew(x)
257 theta = torch.linalg.norm(x, dim=-1, keepdim=True).unsqueeze(-1)
258 I = torch.eye(3, device=x.device, dtype=x.dtype).expand(x.lshape+(3, 3))

File ~/workspace/pypose/pypose/lietensor/basics.py:34, in vec2skew(input)
5 def vec2skew(input:torch.Tensor) -> torch.Tensor:
6 r"""
7 Convert batched vectors to skew matrices.
8
(...)
32 [ 1.2761, -0.2929, 0.0000]]])
33 """
---> 34 v = input.tensor() if hasattr(input, 'ltype') else input
35 assert v.shape[-1] == 3, "Last dim should be 3"
36 O = torch.zeros(v.shape[:-1], device=v.device, dtype=v.dtype, requires_grad=v.requires_grad)

File ~/workspace/pypose/pypose/lietensor/lietensor.py:674, in LieTensor.tensor(self)
661 def tensor(self) -> torch.Tensor:
662 r'''
663 Return the torch.Tensor without changing data.
664
(...)
672 [ 0.9198, -0.2704, -0.2395, 0.1532]])
673 '''
--> 674 return torch.Tensor(self)

TypeError: expected TensorOptions(dtype=float, device=cpu, layout=Strided, requires_grad=false (default), pinned_memory=false (default), memory_format=(nullopt)) (got TensorOptions(dtype=float, device=cuda:0, layout=Strided, requires_grad=false (default), pinned_memory=false (default), memory_format=(nullopt)))

Cubic-spline Interpolation in SE3

๐Ÿš€ The feature, motivation and pitch

A cubic spline is a spline constructed of piecewise third-order polynomials which pass through a set of m control points. It is quite useful for trajectory generation and smoothness. The current implementation support only interpolation with the (x, y, z) coordinate but does not support SE3 for orientation interpolation. Here attached an example code that supports branch operation for cubic-spline interpolation in (x, y, z):

import torch

class CubicSplineTorch:
    # Reference: https://stackoverflow.com/questions/61616810/how-to-do-cubic-spline-interpolation-and-integration-in-pytorch
    def __init__(self):
        return None

    def h_poly(self, t):
        alpha = torch.arange(4, device=t.device, dtype=t.dtype)
        tt = t[:, None, :]**alpha[None, :, None]
        A = torch.tensor([
            [1, 0, -3, 2],
            [0, 1, -2, 1],
            [0, 0, 3, -2],
            [0, 0, -1, 1]
            ], dtype=t.dtype, device=t.device)
        return A @ tt

    def interp(self, x, y, xs):
        m = (y[:, 1:, :] - y[:, :-1, :]) / torch.unsqueeze(x[:, 1:] - x[:, :-1], 2)
        m = torch.cat([m[:, None, 0], (m[:, 1:] + m[:, :-1]) / 2, m[:, None, -1]], 1)
        idxs = torch.searchsorted(x[0, 1:], xs[0, :])
        dx = x[:, idxs + 1] - x[:, idxs]
        hh = self.h_poly((xs - x[:, idxs]) / dx)
        hh = torch.transpose(hh, 1, 2)
        out = hh[:, :, 0:1] * y[:, idxs, :]
        out = out + hh[:, :, 1:2] * m[:, idxs] * dx[:,:,None]
        out = out + hh[:, :, 2:3] * y[:, idxs + 1, :]
        out = out + hh[:, :, 3:4] * m[:, idxs + 1] * dx[:,:,None]
        return out


def TrajGeneratorFromPoints(points, steps=0.1): 
    # Points is in se3
    cs_interp = CubicSplineTorch()
    batch_size, num_p, dims = points.shape
    num_p = num_p
    xs = torch.arange(0, num_p-1+steps, steps, device=points.device)
    xs = xs.repeat(batch_size, 1)
    x  = torch.arange(num_p, device=points.device, dtype=points.dtype)
    x  = x.repeat(batch_size, 1)
    waypoints = cs_interp.interp(x, points, xs)
    return waypoints 

Then it is good to have an extension using PyPose to support full SE3 (translation + orientation) cubic-spline interpolation.

  • Input: Points in SE3 shape: (batch_size, n_poins, 7); step size
  • Output: Interpolated Points in SE3 - Shape (batch_size, n_points / step_size + 1, 7)

Alternatives

No response

Additional context

No response

view size and memory

Summary

view size and memory

Example Case

>>> pp.randn_SO3(10,50)[:,:5].Inv()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/yuheng/workspace/pypose/pypose/lietensor/lietensor.py", line 662, in Inv
    return self.ltype.Inv(self)
  File "/home/yuheng/workspace/pypose/pypose/lietensor/lietensor.py", line 65, in Inv
    out = self.__op__(self.lid, inv, x)
  File "/home/yuheng/workspace/pypose/pypose/lietensor/lietensor.py", line 151, in __op__
    inputs, out_shape = cls.__broadcast_inputs(x, y)
  File "/home/yuheng/workspace/pypose/pypose/lietensor/lietensor.py", line 161, in __broadcast_inputs
    return (x.view(-1, xd).contiguous(), ), x.shape[:-1]
  File "/home/yuheng/workspace/pypose/pypose/lietensor/lietensor.py", line 580, in __torch_function__
    data = torch.Tensor.__torch_function__(func, ltypes, args, kwargs)
  File "/home/yuheng/anaconda3/lib/python3.9/site-packages/torch/_tensor.py", line 1142, in __torch_function__
    ret = func(*args, **kwargs)
RuntimeError: view size is not compatible with input tensor's size and stride (at least one dimension spans across two contiguous subspaces). Use .reshape(...) instead.

Add Sparse Block Tensor

In PR #96 , sparse block tensors are defined as object, but not a subclass of Tensor, need to be refactored before merging, following the style of LieTensor.

Add a general hat function

Problem to solve

Add a general hat function to replace the current vec2skew

Further details

Besides so3, which has a 3x3 skew matrix, all the rest of se3, sim3, etc types have the the closed form representation of the hat matrix, which are used pretty often.

Proposal

For each Lie Type, create a corresponding hat function.

Documentation

Args: input (LieTensor): The input LieTensor (Lie algebra)
Return: a matrix representing the hat operation

Testing

No risk.

add LM optimizer

  • LM optimizer that accepts high dimensional (non-scalar) tensor output is required in many algorithms, e.g., bundle adjustments.
  • The difficult thing is that this requires Jacobian matrix instead of simple gradient.
  • add a class LM in pypose.optim, which is a subclass of torch.optim.Optimizer.

Doc for IMUPreintegrator

Problem to solve

  • The current doc for pypose.module.IMUPreintegrator is incomplete.
  • More mathematical background for update function is needed.

Add Kalman Filter

Problem to solve

Kalman Filter is often needed for state estimation. It can be added to pypose/module

  • A generalized Kalman Filter leveraging on the automatic differentiation for Jacobian computation is preferred.

cumprod cuda issue

Summary

cumprod cuda issue

Steps to reproduce

Python 3.9.12 (main, Apr  5 2022, 06:56:58) 
[GCC 7.5.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pypose as pp
>>> dr = pp.identity_SO3(1,2)
>>> pp.cumprod(dr, dim = 1)
SO3Type LieTensor:
tensor([[[0., 0., 0., 1.],
         [0., 0., 0., 1.]]])
>>> dr = pp.identity_SO3(1,2, device="cuda:0")
>>> pp.cumprod(dr, dim = 1)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/yuheng/workspace/pypose/pypose/lietensor/lietensor.py", line 573, in __repr__
    ' %s:\n'%(self.__class__.__name__) + super().__repr__()
  File "/home/yuheng/anaconda3/lib/python3.9/site-packages/torch/_tensor.py", line 303, in __repr__
    return handle_torch_function(Tensor.__repr__, (self,), self)
  File "/home/yuheng/anaconda3/lib/python3.9/site-packages/torch/overrides.py", line 1394, in handle_torch_function
    result = torch_func_method(public_api, types, args, kwargs)
  File "/home/yuheng/workspace/pypose/pypose/lietensor/lietensor.py", line 580, in __torch_function__
    data = torch.Tensor.__torch_function__(func, ltypes, args, kwargs)
  File "/home/yuheng/anaconda3/lib/python3.9/site-packages/torch/_tensor.py", line 1142, in __torch_function__
    ret = func(*args, **kwargs)
  File "/home/yuheng/anaconda3/lib/python3.9/site-packages/torch/_tensor.py", line 305, in __repr__
    return torch._tensor_str._str(self)
  File "/home/yuheng/anaconda3/lib/python3.9/site-packages/functorch/_src/monkey_patching.py", line 23, in _functorch_str
    return _old_str(tensor)
  File "/home/yuheng/anaconda3/lib/python3.9/site-packages/torch/_tensor_str.py", line 434, in _str
    return _str_intern(self)
  File "/home/yuheng/anaconda3/lib/python3.9/site-packages/torch/_tensor_str.py", line 409, in _str_intern
    tensor_str = _tensor_str(self, indent)
  File "/home/yuheng/anaconda3/lib/python3.9/site-packages/torch/_tensor_str.py", line 264, in _tensor_str
    formatter = _Formatter(get_summarized_data(self) if summarize else self)
  File "/home/yuheng/anaconda3/lib/python3.9/site-packages/torch/_tensor_str.py", line 100, in __init__
    nonzero_finite_vals = torch.masked_select(tensor_view, torch.isfinite(tensor_view) & tensor_view.ne(0))
RuntimeError: CUDA error: invalid configuration argument

mat2SO3

Summary

Steps to reproduce

vicon_ext_R = np.array([[0.33638, -0.01749, 0.94156],[-0.02078, -0.99972, -0.01114],[0.94150, -0.01582, -0.33665]])
pp.mat2SO3(vicon_ext_R)
Traceback (most recent call last):
File "", line 1, in
File "/home/yuheng/workspace/pypose/pypose/lietensor/convert.py", line 81, in mat2SO3
raise ValueError("Input rotation matrices are not all orthogonal matrix")
ValueError: Input rotation matrices are not all orthogonal matrix

@wang-chen could you please take a look?

System Dynamics base and Example classes.

Problem to solve

The system state transition model is widely required in many applications.
For example, when using an EKF, or running an MPC.

Add a general base class for system dynamics, e.g., base class pypose.module._System (subclass of torch.nn.Module) and provide several example classes (subclass of _System):

  • _System
  • Linear system
  • Non-linear system

Further details and Proposal

To work with other higher-level applications, e.g., state estimation, system identification, and model predictive control, the system models could provide the following consistent API (Pseudo Code).

Functions like sysmat, inmat, outmat, '' for model linearization also need to be provided by calling auto diff like jacobian.

  • sysmat (system matrix, A)
  • inmat (input matrix, B)
  • outmat (output matrix, C)
    ...
class _System(nn.Module):
    def __init__(self, time=False):
        super().__init__()
        if time:
            self.register_buffer('t', torch.zeros(1))
            self.register_forward_hook(self.timeplus1)

    def timeplus1(self, module, inputs, outputs) -> Callable:
        self.t.add_(1)

    def forward(self, state, input):
        state = self.state_transition(state, input)
        return self.observation(state, input)
     
    def state_transition(self):
        ...

    def observation(self):
        ....

    def reset(self, t=0):
        self.t.fill_(t)
    
    @property
    def A(self):
        ....

class LTI(_System):
    def __init__(self, N, A, B=None, C=None, D=None):
        self.register_buffer('A', A)
        self.register_buffer('C', torch.eye(N, N) if C is not None else C)
        ...

    def state_transition(self, state, input):
        return self.A @ state + self.B @ input
    
    def observation(self, state, input):
        return self.C @ state + self.D @ input

User-defined system can be:

class SimpleSystem(LTI):
    def __init__(self, N, A):
        super().__init__(N, A)

    def state_transition(self, state, input):
        return self.A @ state + self.B @ inputs
    
    def observation(self, state, input):
        return state

Optional: Links / references

add mat2XXX

Problem to solve

Matrix to LieGroup is often needed.
The following conversion functions can be added.

  • pypose.mat2SO3()
  • pypose.mat2SE3()
  • pypose.mat2Sim3()
  • pypose.mat2RxSO3()
  • or pypose.from_matrix(), which automatically determines the ouptut ltype from the matrix shape (may be confusion with future tensor type).

We can also create the following function which takes a LieTensor as input and output its matrix form.

  • pypose.matrix() (pp.matrix(x) is equivalent to x.matrix())

Add equation for Doc mat2SO3

Problem to solve

The current doc for`mat2SO3', see here, is short and not clear.
It could be better if the equation explanation is added following Log.

Add Bundle Adjustment Module

๐Ÿš€ The feature, motivation and pitch

As stated in the title, a differential bundle adjustment module is required in many SLAM systems.
This module may require the following implemented functionalities.

Alternatives

No response

Additional context

No response

add module Jacobian with respect to Parameters

The current Jacobian computation in PyTorch only supports functions with respect to inputs.

However, we also need to get the gradient of output with respect to the model parameters.

One possible way is to extract the weights and put them back into the Module so that we can write a function that actually takes the Parameters as input. Then we can call into functions like torch.autograd.functional.jacobian() with it.

Add model predictive control (MPC)

Problem to solve

MPC is often used for real robotic applications. Its optimization function may work with the imperative supervision in PyPose, we may have a folder named control/MPC under pypose/module.

Gradient of covariance propagation of IMU integrator is not trackable.

Gradient of covariance propagation of IMU integrator is not trackable.

Summary

  • The current implementation is based on creating new tensors without requires_grad=True, see here. However, if set requires_grad=True, then directly inplace setting its value is not permitted, like here.
  • Passing covariance as an argument is not working, see here. Interfaces and codes need to be rephrased.

Possible fixes

  • Consider to use torch.stack or torch.cat to retain its gradients, like here.

  • Assume x = torch.zeros(), use x[i]= x[i] + y, instead of x[i]= y for value setting.

Add batched IMU preintergration processing

Problem to solve

The current implementation of IMU preintegration is only able to take precess the input signal sequentially (loop over time), while batched processing is often needed for Visual/LiDAR inertial odometry systems. This could result in processing acceleration. Several functions needed are implemented already, e.g., pypose.cumprod().

add damping factor scheduler for LM and other optmizers.

Problem to solve

Different from 1st order optimizers like torch.SGD, 2nd order optimizers like pypose.LM require a damping factor instead of a learning rate (lr), hence a damping factor scheduler will be required.

Further details

We would like to first provide a simple damping factor scheduler like what is described in Wikipedia, section Choice of damping parameter. For example:

An effective strategy for the control of the damping parameter, called delayed gratification, consists of increasing the parameter by a small amount for each uphill step, and decreasing by a large amount for each downhill step. The idea behind this strategy is to avoid moving downhill too fast in the beginning of optimization, therefore restricting the steps available in future iterations and therefore slowing down convergence. An increase by a factor of 2 and a decrease by a factor of 3 has been shown to be effective in most cases, while for large problems more extreme values can work better, with an increase by a factor of 1.5 and a decrease by a factor of 5.

We would like to set the uphill and downhill factors as a hyperparameter for the damping factor scheduler.

Proposal

  • A simple implementation is to subclass torch.optim. _LRScheduler and provide a scheduler like torch.optim.ReduceLROnPlateau. However, it uses the interface of lr not damping. To resue its codes and change the damping factor in each epoch, we need to redefine the internal class method get_lr , which will make the codes confusing, as we use it to change the damping factor.

  • Another way is to redefine a general scheduler called pypose.optim._GeneralScheduler following the definition of _LRScheduler, which will also allow the PyPose users to redefine their own schedulers.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.