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

Enable python copy&deepcopy for tensor geometry #5709

Merged
merged 1 commit into from
Nov 22, 2022

Conversation

yuecideng
Copy link
Collaborator

@yuecideng yuecideng commented Nov 19, 2022

Use case:

import open3d as o3d
import copy

Class Foo:
    def __init__(self, name='foo', pcd=None):
        self.name = name
        self.pcd = pcd

a = Foo('test', pcd=o3d.t.geometry.PointCloud())
b = copy.deepcopy(b)

Error will occur if no adding bind_copy_functions in pybind:
image


This change is Reviewable

@update-docs
Copy link

update-docs bot commented Nov 19, 2022

Thanks for submitting this pull request! The maintainers of this repository would appreciate if you could update the CHANGELOG.md based on your changes.

@yuecideng yuecideng requested review from ssheorey and yxlao November 20, 2022 05:19
Copy link
Member

@ssheorey ssheorey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @yuecideng I can't find bind_copy_functions in pybind11 docs / source code. They recommend using the copy ctor instead:
https://pybind11.readthedocs.io/en/stable/advanced/classes.html?highlight=deepcopy#deepcopy-support

Can you point to some docs / reference for using bind_copy_functions over the copy ctor?

@yuecideng
Copy link
Collaborator Author

Hi @ssheorey , this function has been implemented in Open3D, which is the same with the way suggested in pybind docs.
https://github.com/isl-org/Open3D/blob/master/cpp/pybind/open3d_pybind.h#:~:text=void%20bind_copy_functions(Class_%20%26cl)%20%7B

@yuecideng
Copy link
Collaborator Author

Seems that one Ubuntu CUDA CI fails many times, although I rerun it several times.

@yuecideng yuecideng merged commit 61276a0 into master Nov 22, 2022
@yuecideng yuecideng deleted the yueci/enable-python-copy branch November 22, 2022 16:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants