Skip to content

Fixed corrupted default values in documentation#7148

Merged
ssheorey merged 6 commits intoisl-org:mainfrom
timohl:device-docs-fix
Mar 8, 2025
Merged

Fixed corrupted default values in documentation#7148
ssheorey merged 6 commits intoisl-org:mainfrom
timohl:device-docs-fix

Conversation

@timohl
Copy link
Contributor

@timohl timohl commented Jan 26, 2025

Type

Motivation and Context

Devices in default values cause corrupted rendering in the documentation as shown in #7147.
The reason is that o3d.core.Device.__repr__ returns a string like this: CPU:0.
Sphinx docs generation seems to misinterpret : in default values.

Also, I found a similar problem with the enum VoxelPoolingMode.
The raw enum value also contains a : and causes faulty documentation.
voxelpoolingmode

I found a similar issue here: sphinx-doc/sphinx#9266

Checklist:

  • I have run python util/check_style.py --apply to apply Open3D code style
    to my code.
  • This PR changes Open3D behavior or adds new functionality.
    • Both C++ (Doxygen) and Python (Sphinx / Google style) documentation is
      updated accordingly.
    • I have added or updated C++ and / or Python unit tests OR included test
      results
      (e.g. screenshots or numbers) here.
  • I will follow up and update the code if CI fails.
  • For fork PRs, I have selected Allow edits from maintainers.

Description

In order to fix this, I changed o3d.core.Device.__repr__.
Instead of CPU:0 it now returns Device("CPU", 0) (which is now also correct Python code).

o3d_device_in_default

I fixed the VoxelPoolingMode issue using py::arg_v to define the Python representation explicitly.
voxelpoolingmode_fixed

I marked this as a breaking change because it changes the output of o3d.core.Device.__repr__.

Also, I fixed some minor typos, added mentioning of SYCL in some error messages and added the missing Python binding for DeviceType.SYCL.

Copy link
Contributor

@joseph-sch joseph-sch left a comment

Choose a reason for hiding this comment

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

Looks great to me :-)

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.

Thanks @timohl !

@ssheorey ssheorey merged commit 80f70b9 into isl-org:main Mar 8, 2025
38 of 39 checks passed
@timohl timohl mentioned this pull request Aug 20, 2025
9 tasks
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.

Python API docs corrupted where last argument is device=core::Device("CPU:0")

3 participants