Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Round trip torch.save / torch.load not working for Hyperplane #2126

Closed
Hackerman342 opened this issue Jan 4, 2023 · 1 comment · Fixed by #2132
Closed

Round trip torch.save / torch.load not working for Hyperplane #2126

Hackerman342 opened this issue Jan 4, 2023 · 1 comment · Fixed by #2132
Assignees
Labels
help wanted Extra attention is needed

Comments

@Hackerman342
Copy link

Hackerman342 commented Jan 4, 2023

Describe the bug

Crashing when trying to save and reload a Hyperplane using torch:

Traceback (most recent call last):
  File "save_hyperplane.py", line 16, in <module>
    plane = torch.load("./saved_plane.pt")
  File "/home/kyle/venv/lib/python3.8/site-packages/torch/serialization.py", line 789, in load
    return _load(opened_zipfile, map_location, pickle_module, **pickle_load_args)
  File "/home/kyle/venv/lib/python3.8/site-packages/torch/serialization.py", line 1131, in _load
    result = unpickler.load()
  File "/home/kyle/venv/lib/python3.8/site-packages/kornia/core/tensor_wrapper.py", line 48, in __getattr__
    self.used_attrs.add(name)
  File "/home/kyle/venv/lib/python3.8/site-packages/kornia/core/tensor_wrapper.py", line 48, in __getattr__
    self.used_attrs.add(name)
  File "/home/kyle/venv/lib/python3.8/site-packages/kornia/core/tensor_wrapper.py", line 48, in __getattr__
    self.used_attrs.add(name)
  [Previous line repeated 993 more times]
RecursionError: maximum recursion depth exceeded

Reproduction steps

$ python3 -m venv venv
$ source venv/bin/activate
(venv) $ pip install kornia
(venv) $ pip install numpy
(venv) $ python save_hyperplane.py

Content of save_hyperplane.py

from kornia.geometry.plane import Hyperplane
from kornia.geometry.vector import Vec3, Scalar
import torch

plane = Hyperplane(
    Vec3(torch.tensor([0,0,1])), Scalar(torch.tensor(0.5))
)

torch.save(plane, "./saved_plane.pt")
plane = torch.load("./saved_plane.pt")

Expected behavior

Hyperplane is able to be saved and reloaded with torch.save & torch.load

Environment

Collecting environment information...
PyTorch version: 1.13.1+cu117
Is debug build: False
CUDA used to build PyTorch: 11.7
ROCM used to build PyTorch: N/A

OS: Ubuntu 20.04.5 LTS (x86_64)
GCC version: (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0
Clang version: Could not collect
CMake version: version 3.16.3
Libc version: glibc-2.31

Python version: 3.8.10 (default, Nov 14 2022, 12:59:47)  [GCC 9.4.0] (64-bit runtime)
Python platform: Linux-5.15.0-56-generic-x86_64-with-glibc2.29
Is CUDA available: True
CUDA runtime version: Could not collect
CUDA_MODULE_LOADING set to: LAZY
GPU models and configuration: GPU 0: NVIDIA GeForce RTX 3080 Laptop GPU
Nvidia driver version: 470.141.03
cuDNN version: Could not collect
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True

Versions of relevant libraries:
[pip3] numpy==1.24.1
[pip3] torch==1.13.1
[conda] Could not collect

Additional context

No response

@Hackerman342 Hackerman342 added the help wanted Extra attention is needed label Jan 4, 2023
@edgarriba
Copy link
Member

@Hackerman342 will take a look soon. This i guess is after introducing Vector3 and Scalar types

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants