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

Fix compute_and_save_png_slices binding default parameter value to match parameter type #1478

Merged
merged 1 commit into from
Feb 5, 2024

Conversation

Nolan1324
Copy link
Contributor

In the Python bindings file python_api.cu, the binding for compute_and_save_png_slices has a mistake. The binding contains py::arg("resolution") = ivec3(256) which sets the default value of this argument to a value of type ivec3. However, compute_and_save_png_slices has the following function declaration in testbed.h

ivec3 compute_and_save_png_slices(const fs::path& filename, int res, BoundingBox aabb = {}, float thresh = 2.5f, float density_range = 4.f, bool flip_y_and_z_axes = false);

This reveals that the correct type of res is in fact int for this function, rather than ivec3.

This can cause some confusion and errors. For example, if arguments of incorrect type are passed to the binding, the following error is thrown:

TypeError: compute_and_save_png_slices(): incompatible function arguments. The following argument types are supported:
    1. (self: pyngp.Testbed, filename: pyngp.path, resolution: int = array([256, 256, 256]), aabb: pyngp.BoundingBox = <pyngp.BoundingBox object at 0x0000029235215F70>, thresh: float = 3.4028234663852886e+38, density_range: float = 4.0, flip_y_and_z_axes: bool = False) -> vec

This could make it seem that the type of resolution is an array, when in fact it is a scalar.

To resolve this, I request changing the default value in the binding definition from ivec3(256) to 256.

@Tom94
Copy link
Collaborator

Tom94 commented Feb 5, 2024

Thanks for the fix -- and apologies for the delay.

@Tom94 Tom94 merged commit cc74914 into NVlabs:master Feb 5, 2024
fnysalehi pushed a commit to fnysalehi/instant-ngp-rendering that referenced this pull request May 14, 2024
Fix compute_and_save_png_slices binding default parameter value to match parameter type
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