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

Changed lambda to lambda_penalty in orient_normals_consistent_tangent_plane #7096

Merged
merged 1 commit into from
Dec 18, 2024

Conversation

timohl
Copy link
Contributor

@timohl timohl commented Dec 16, 2024

Type

  • Bug fix (non-breaking change which fixes an issue): Fixes #
  • 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

lambda is a reserved keyword in python.
Using it as a keyword argument causes an invalid syntax error:

    import open3d as o3d
    p = o3d.t.geometry.PointCloud()
    p.point.positions = o3d.core.Tensor([[10, 10, 10], [1, 1, 1], [0, 0, 1], [0, 0, 0]], dtype=o3d.core.float64) 
    p.point.normals = o3d.core.Tensor([[1, 0, 0], [1, 0, 0], [1, 0, 0], [1, 0, 0]], dtype=o3d.core.float64) 
    p.orient_normals_consistent_tangent_plane(1, 10) # No error
    p.orient_normals_consistent_tangent_plane(1, lambda=10) # SyntaxError
                                                       ^
SyntaxError: invalid syntax

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

This PR replaces lambda with lambda_penalty
Existing code should usually not break (since using lambda as a keyword argument is already broken).
Except if somebody is using dict unpacking to populate parameters.
E.g., p.orient_normals_consistent_tangent_plane(1, **{"lambda": 10}).
This would have to be change to use lambda_penalty.

This is a fix used in #6917 since mypy would complain about lambda in generated stubs.

…gent_plane.

`lambda` is a reserved keyword in python and causes mypy to complain.
Copy link

update-docs bot commented Dec 16, 2024

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

@ssheorey ssheorey merged commit 0ae7b1a into isl-org:main Dec 18, 2024
38 of 39 checks passed
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