Skip to content

Act does not return correct shape when acting on empty tensor. #342

Closed
@MarkChenYutian

Description

🐛 Describe the bug

The Act function receives a Nx3 or Nx4 tensor, perform the transformation represented by the LieTensor and returns a new tensor of shape Nx3 or Nx4 respectively.

However, when the input tensor is of shape 0x3 or 0x4, the Act method will return a 0x7 shaped tensor instead. Which harms the robustness of user's program due to this unexpected size on dimension 1.

To reproduce this, try

>>> import pypose as pp
>>> import torch
>>> pp.identity_SE3() @ pp.pixel2point(torch.zeros((0, 2)), torch.zeros((0,)), torch.eye(3))
tensor([], size=(0, 7))
>>> pp.pixel2point(torch.zeros((0, 2)), torch.zeros((0,)), torch.eye(3))
tensor([], size=(0, 3))
>>> 

Versions

Collecting environment information...
PyTorch version: 2.3.0
Is debug build: False
CUDA used to build PyTorch: 12.1
ROCM used to build PyTorch: N/A

OS: Springdale Open Enterprise Linux 8.6 (Modena) (x86_64)
GCC version: (GCC) 8.5.0 20210514 (Red Hat 8.5.0-10)
Clang version: Could not collect
CMake version: version 3.20.2
Libc version: glibc-2.28

Python version: 3.11.9 (main, Apr 19 2024, 16:48:06) [GCC 11.2.0] (64-bit runtime)
Python platform: Linux-4.18.0-372.32.1.el8_6.x86_64-x86_64-with-glibc2.28
Is CUDA available: True
CUDA runtime version: Could not collect
GPU models and configuration: GPU 0: NVIDIA A100 80GB PCIe
Nvidia driver version: 545.23.08
cuDNN version: Probably one of the following:
/usr/lib64/libcudnn.so.8.9.4
/usr/lib64/libcudnn_adv_infer.so.8.9.4
/usr/lib64/libcudnn_adv_train.so.8.9.4
/usr/lib64/libcudnn_cnn_infer.so.8.9.4
/usr/lib64/libcudnn_cnn_train.so.8.9.4
/usr/lib64/libcudnn_ops_infer.so.8.9.4
/usr/lib64/libcudnn_ops_train.so.8.9.4
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True

Versions of relevant libraries:
[pip3] numpy==1.26.4
[pip3] torch==2.3.0
[pip3] torch-scatter==2.1.2
[pip3] torchaudio==2.3.0
[pip3] torchvision==0.18.0
[conda] blas                      1.0                         mkl  
[conda] ffmpeg                    4.3                  hf484d3e_0    pytorch
[conda] libjpeg-turbo             2.0.0                h9bf148f_0    pytorch
[conda] mkl                       2023.1.0         h213fc3f_46344  
[conda] mkl-service               2.4.0           py311h5eee18b_1  
[conda] mkl_fft                   1.3.8           py311h5eee18b_0  
[conda] mkl_random                1.2.4           py311hdb19cb5_0  
[conda] numpy                     1.26.4          py311h08b1b3b_0  
[conda] numpy-base                1.26.4          py311hf175353_0  
[conda] pytorch                   2.3.0           py3.11_cuda12.1_cudnn8.9.2_0    pytorch
[conda] pytorch-cuda              12.1                 ha16c6d3_5    pytorch
[conda] pytorch-mutex             1.0                        cuda    pytorch
[conda] pytorch-scatter           2.1.2           py311_torch_2.3.0_cu121    pyg
[conda] torchaudio                2.3.0               py311_cu121    pytorch
[conda] torchtriton               2.3.0                     py311    pytorch
[conda] torchvision               0.18.0              py311_cu121    pytorch

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions