Skip to content

Fix xlogy returning 0 instead of NaN when self is 0 and other is NaN - #3073

Open
Mohammed Alkindi (MohammedAlkindi) wants to merge 1 commit into
microsoft:mainfrom
MohammedAlkindi:fix/xlogy-nan-other
Open

Mohammed Alkindi (MohammedAlkindi) wants to merge 1 commit into
microsoft:mainfrom
MohammedAlkindi:fix/xlogy-nan-other

Conversation

@MohammedAlkindi

Copy link
Copy Markdown
Contributor

aten_special_xlogy applied the NaN mask before the zero mask, so xlogy(0, nan) returned 0. torch.xlogy returns NaN wherever other is NaN, including where self is 0. Swapping the two Where nodes makes the NaN case win. The masks only overlap where self is 0 and other is NaN, so no other input changes.

The new e2e_ops_tests.py case exports torch.xlogy and compares with eager. It fails before (1 of 5 elements mismatched) and passes after. ruff check and ruff format --check are clean.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

1 participant