fix(flow_de): remove dead code and fix stale NaN debug prints#21
Open
invo-coder19 wants to merge 1 commit into
Open
fix(flow_de): remove dead code and fix stale NaN debug prints#21invo-coder19 wants to merge 1 commit into
invo-coder19 wants to merge 1 commit into
Conversation
The logsumexp refactor (replacing the old torch.where clamp approach)
was completed earlier but left behind two issues:
1. Dead commented-out block (old implementation, ~33 lines)
The original numerically-unstable implementation that used
orch.where(v2 < 207, v2, 207) and intermediate variables
pt, ptsum, pt_sum was left as a triple-quoted string
comment. This added noise and confusion for contributors.
Removed entirely and replaced with a short comment explaining
*why* the logsumexp approach was chosen.
2. Latent NameError in the NaN debug guard
After the refactor, pt and pt_sum no longer exist in scope,
but the NaN guard block still attempted to print them:
print(pt) # -> NameError: name 'pt' is not defined
print(pt_sum) # -> NameError: name 'pt_sum' is not defined
If NaN was ever triggered, this would raise a NameError *before*
the actual ValueError, masking the real bug entirely.
Fixed to print the live intermediates that are in scope:
�2, log_weights, and wt.
No functional changes — behaviour is identical for all valid inputs.
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.
The logsumexp refactor (replacing the old torch.where clamp approach) was completed earlier but left behind two issues:
Dead commented-out block (old implementation, ~33 lines) The original numerically-unstable implementation that used orch.where(v2 < 207, v2, 207) and intermediate variables pt, ptsum, pt_sum was left as a triple-quoted string comment. This added noise and confusion for contributors. Removed entirely and replaced with a short comment explaining why the logsumexp approach was chosen.
Latent NameError in the NaN debug guard After the refactor, pt and pt_sum no longer exist in scope, but the NaN guard block still attempted to print them:
print(pt) # -> NameError: name 'pt' is not defined
print(pt_sum) # -> NameError: name 'pt_sum' is not defined
If NaN was ever triggered, this would raise a NameError before
the actual ValueError, masking the real bug entirely.
Fixed to print the live intermediates that are in scope:
�2, log_weights, and wt.
No functional changes — behaviour is identical for all valid inputs.