Fix loop variable shadowing in marching_cubes_mesh#120
Open
Mr-Neutr0n wants to merge 1 commit intoopenai:mainfrom
Open
Fix loop variable shadowing in marching_cubes_mesh#120Mr-Neutr0n wants to merge 1 commit intoopenai:mainfrom
Mr-Neutr0n wants to merge 1 commit intoopenai:mainfrom
Conversation
In marching_cubes_mesh(), the outer loop iterator `indices` (a range object) is reassigned to a torch.arange tensor on the first line of the loop body. This shadows the loop variable, causing the for-loop to exit after only the first batch iteration. As a result, only the first `batch_size` voxels out of `grid_size**3` are evaluated, producing an incomplete SDF volume and a corrupt mesh. Rename the inner variable to `batch_indices` to avoid the collision.
|
[celebrate] VICTOR ALFONSO ARDILA MONTALBAN reacted to your message:
…________________________________
From: Harikrishna KP ***@***.***>
Sent: Wednesday, February 11, 2026 6:35:01 PM
To: openai/point-e ***@***.***>
Cc: Subscribed ***@***.***>
Subject: [openai/point-e] Fix loop variable shadowing in marching_cubes_mesh (PR #120)
Summary
In marching_cubes_mesh(), the outer loop iterator indices (a range object used in for i in indices) is reassigned to a torch.arange tensor on the first line of the loop body (line 54). This shadows the loop variable, causing the for-loop to exit after processing only the first batch.
As a result, only the first batch_size voxels (default 4096) out of grid_size**3 (default 128^3 = 2,097,152) are ever evaluated. The SDF volume is mostly uninitialized, producing a corrupt mesh output.
Fix: Rename the inner variable from indices to batch_indices to avoid the name collision with the loop iterator.
Before (bug)
for i in indices:
indices = torch.arange(...) # shadows the loop iterator
zs = int_coord_to_float(indices % grid_size)
...
After (fix)
for i in indices:
batch_indices = torch.arange(...)
zs = int_coord_to_float(batch_indices % grid_size)
...
________________________________
You can view, comment on, or merge this pull request online at:
#120
Commit Summary
* e75677e<e75677e> Fix loop variable shadowing in marching_cubes_mesh
File Changes
(1 file<https://github.com/openai/point-e/pull/120/files>)
* M point_e/util/pc_to_mesh.py<https://github.com/openai/point-e/pull/120/files#diff-a2e427263ce6e400d15939328392c0b1f52056d4b105f68be32992c93b63fa83> (8)
Patch Links:
* https://github.com/openai/point-e/pull/120.patch
* https://github.com/openai/point-e/pull/120.diff
—
Reply to this email directly, view it on GitHub<#120>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AVLHBQ5PRUBCZ2GC7DM4RWL4LNY5HAVCNFSM6AAAAACUZGJVPGVHI2DSMVQWIX3LMV43ASLTON2WKOZTHEZDQMBUGQ4DCNQ>.
You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
|
[0] VICTOR ALFONSO ARDILA MONTALBAN reacted to your message:
…________________________________
From: Harikrishna KP ***@***.***>
Sent: Wednesday, February 11, 2026 6:35:01 PM
To: openai/point-e ***@***.***>
Cc: Subscribed ***@***.***>
Subject: [openai/point-e] Fix loop variable shadowing in marching_cubes_mesh (PR #120)
Summary
In marching_cubes_mesh(), the outer loop iterator indices (a range object used in for i in indices) is reassigned to a torch.arange tensor on the first line of the loop body (line 54). This shadows the loop variable, causing the for-loop to exit after processing only the first batch.
As a result, only the first batch_size voxels (default 4096) out of grid_size**3 (default 128^3 = 2,097,152) are ever evaluated. The SDF volume is mostly uninitialized, producing a corrupt mesh output.
Fix: Rename the inner variable from indices to batch_indices to avoid the name collision with the loop iterator.
Before (bug)
for i in indices:
indices = torch.arange(...) # shadows the loop iterator
zs = int_coord_to_float(indices % grid_size)
...
After (fix)
for i in indices:
batch_indices = torch.arange(...)
zs = int_coord_to_float(batch_indices % grid_size)
...
________________________________
You can view, comment on, or merge this pull request online at:
#120
Commit Summary
* e75677e<e75677e> Fix loop variable shadowing in marching_cubes_mesh
File Changes
(1 file<https://github.com/openai/point-e/pull/120/files>)
* M point_e/util/pc_to_mesh.py<https://github.com/openai/point-e/pull/120/files#diff-a2e427263ce6e400d15939328392c0b1f52056d4b105f68be32992c93b63fa83> (8)
Patch Links:
* https://github.com/openai/point-e/pull/120.patch
* https://github.com/openai/point-e/pull/120.diff
—
Reply to this email directly, view it on GitHub<#120>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AVLHBQ5PRUBCZ2GC7DM4RWL4LNY5HAVCNFSM6AAAAACUZGJVPGVHI2DSMVQWIX3LMV43ASLTON2WKOZTHEZDQMBUGQ4DCNQ>.
You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
|
[like] VICTOR ALFONSO ARDILA MONTALBAN reacted to your message:
…________________________________
From: Harikrishna KP ***@***.***>
Sent: Wednesday, February 11, 2026 6:35:01 PM
To: openai/point-e ***@***.***>
Cc: Subscribed ***@***.***>
Subject: [openai/point-e] Fix loop variable shadowing in marching_cubes_mesh (PR #120)
Summary
In marching_cubes_mesh(), the outer loop iterator indices (a range object used in for i in indices) is reassigned to a torch.arange tensor on the first line of the loop body (line 54). This shadows the loop variable, causing the for-loop to exit after processing only the first batch.
As a result, only the first batch_size voxels (default 4096) out of grid_size**3 (default 128^3 = 2,097,152) are ever evaluated. The SDF volume is mostly uninitialized, producing a corrupt mesh output.
Fix: Rename the inner variable from indices to batch_indices to avoid the name collision with the loop iterator.
Before (bug)
for i in indices:
indices = torch.arange(...) # shadows the loop iterator
zs = int_coord_to_float(indices % grid_size)
...
After (fix)
for i in indices:
batch_indices = torch.arange(...)
zs = int_coord_to_float(batch_indices % grid_size)
...
________________________________
You can view, comment on, or merge this pull request online at:
#120
Commit Summary
* e75677e<e75677e> Fix loop variable shadowing in marching_cubes_mesh
File Changes
(1 file<https://github.com/openai/point-e/pull/120/files>)
* M point_e/util/pc_to_mesh.py<https://github.com/openai/point-e/pull/120/files#diff-a2e427263ce6e400d15939328392c0b1f52056d4b105f68be32992c93b63fa83> (8)
Patch Links:
* https://github.com/openai/point-e/pull/120.patch
* https://github.com/openai/point-e/pull/120.diff
—
Reply to this email directly, view it on GitHub<#120>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AVLHBQ5PRUBCZ2GC7DM4RWL4LNY5HAVCNFSM6AAAAACUZGJVPGVHI2DSMVQWIX3LMV43ASLTON2WKOZTHEZDQMBUGQ4DCNQ>.
You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
In
marching_cubes_mesh(), the outer loop iteratorindices(arangeobject used infor i in indices) is reassigned to atorch.arangetensor on the first line of the loop body (line 54). This shadows the loop variable, causing the for-loop to exit after processing only the first batch.As a result, only the first
batch_sizevoxels (default 4096) out ofgrid_size**3(default 128^3 = 2,097,152) are ever evaluated. The SDF volume is mostly uninitialized, producing a corrupt mesh output.Fix: Rename the inner variable from
indicestobatch_indicesto avoid the name collision with the loop iterator.Before (bug)
After (fix)