Skip to content

fix: NaN assertion uses .all() instead of .any()#908

Open
Mr-Neutr0n wants to merge 1 commit into
CompVis:mainfrom
Mr-Neutr0n:fix/nan-assertion-any-vs-all
Open

fix: NaN assertion uses .all() instead of .any()#908
Mr-Neutr0n wants to merge 1 commit into
CompVis:mainfrom
Mr-Neutr0n:fix/nan-assertion-any-vs-all

Conversation

@Mr-Neutr0n

Copy link
Copy Markdown

Bug

The NaN assertion assert not torch.isnan(x).all() only triggers when ALL values are NaN. The intended check is to catch ANY NaN values, which requires .any().

Fix

Changed .all() to .any() so the assertion catches any NaN values.

@Mr-Neutr0n

Copy link
Copy Markdown
Author

Quick ping on the one-line fix in ddpm.py that corrects the NaN assertion from .all() to .any(). As written, np.all() only flags a NaN if every element is NaN, so a partially NaN tensor would pass through undetected. Would a maintainer be able to take a look?

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.

1 participant