Skip to content

Fix appending empty tensor point clouds - #7533

Open
tianrking wants to merge 1 commit into
isl-org:mainfrom
tianrking:agent/fix-empty-pointcloud-append
Open

Fix appending empty tensor point clouds#7533
tianrking wants to merge 1 commit into
isl-org:mainfrom
tianrking:agent/fix-empty-pointcloud-append

Conversation

@tianrking

Copy link
Copy Markdown

Type

  • Bug fix (non-breaking change which fixes an issue): Fixes Merging empty tensor point cloud fails #7091
  • New feature (non-breaking change which adds functionality). Resolves #
  • Breaking change (fix or feature that would cause existing functionality to not work as expected) Resolves #

Motivation and Context

A default-constructed tensor PointCloud has no declared attributes. Calling
append() currently reads its missing positions entry before there is a dtype
or shape to validate, so the common incremental-accumulation pattern fails. The
opposite operand order fails as well because the populated cloud expects the
schema-less cloud to provide every attribute.

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

Treat only a point cloud with no declared attributes as the identity for
append() / operator+:

  • If exactly one operand has attributes, clone that operand, including its full
    schema, dtype, and device.
  • If both operands are schema-less, return a clone that keeps the left operand's
    device.
  • Keep the existing validation path for zero-length point clouds that do declare
    a schema.
  • Clone the selected operand so the result does not alias its tensors.

The C++ and Python regression coverage exercises both operand orders, schema and
device preservation, the both-empty case, and non-aliasing. The schema-less
operand deliberately uses its default CPU device so accelerator CI also guards
cross-device adoption.

Validation:

  • Reproduced the failure with the released open3d==0.19.0: schema-less +
    populated raises an IndexError; populated + schema-less raises the missing
    positions RuntimeError; schema-less + schema-less raises an IndexError.
  • cmake --build <build-dir> --target tests -- -j1 (136/136 build steps)
  • tests.exe --gtest_filter=PointCloud/PointCloudPermuteDevices.Append/*
    (1 test passed on CPU)
  • clang-format --dry-run --Werror on all four changed C++/header files
  • YAPF diff check and py_compile for the changed Python test
  • pytest --collect-only for python/test/t/geometry/test_pointcloud.py
    (11 tests collected)
  • git diff --check

The Python behavior assertions were not executed locally because the Python
binding was not rebuilt; they are included for the project's wheel CI alongside
the directly executed C++ regression.

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.

Merging empty tensor point cloud fails

1 participant