-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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 Frontend Failing Test: torch - math.paddle.stanh #28493
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Compliance Checks
Thank you for your Pull Request! We have run several checks on this pull request in order to make sure it's suitable for merging into this project. The results are listed in the following section.
Issue Reference
In order to be considered for merging, the pull request description must refer to a specific issue number. This is described in our contributing guide and our PR template.
This check is looking for a phrase similar to: "Fixes #XYZ" or "Resolves #XYZ" where XYZ is the issue number that this PR is meant to address.
Conventional Commit PR Title
In order to be considered for merging, the pull request title must match the specification in conventional commits. You can edit the title in order for this check to pass.
Most often, our PR titles are something like one of these:
- docs: correct typo in README
- feat: implement dark mode"
- fix: correct remove button behavior
Linting Errors
- Found type "null", must be one of "feat","fix","docs","style","refactor","perf","test","build","ci","chore","revert"
- No subject found
This reverts commit e8b30e6.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for the PR @ZJay07 :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Although, the test_paddle_stanh
seems to still fail with paddle and torch backends. You can see that in the logs at https://github.com/unifyai/ivy/actions/runs/8232013594/job/22509022640?pr=28493
Are you able to fix for these two?
Yup, happy to fix it, seems like some results are producing NaN or 0 instead, do you think reducing the min and max of The error seems hard to replicate since it still passes on my local branch |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You shold be able to reproduce the errors using the falsifying examples in the failure logs. Like one example for the failure of test_paddle_stanh is given as
[array([[[-1.0000000e+00, -1.0000000e+00],
E [-1.0000000e+00, -1.0000000e+00],
E [-1.0000000e+00, -1.0000000e+00],
E [-1.0000000e+00, -1.0000000e+00]],
E
E [[-9.0909090e+00, -1.2930438e-38],
E [-1.8302815e-38, -2.3399685e-38],
E [-1.2930438e-38, -1.9542594e-38],
E [-1.2930438e-38, -1.0000000e+00]]], dtype=float32)]),
E scale_a=10.0,
E scale_b=1.0,
so you can write something like
import ivy
import ivy.functional.frontends.paddle as ivy_paddle
ivy.set_backend("torch")
x = ivy.arrayarray([[[-1.0000000e+00, -1.0000000e+00],
[-1.0000000e+00, -1.0000000e+00],
[-1.0000000e+00, -1.0000000e+00],
[-1.0000000e+00, -1.0000000e+00]],
[-9.0909090e+00, -1.2930438e-38],
[-1.8302815e-38, -2.3399685e-38],
[-1.2930438e-38, -1.9542594e-38],
[-1.2930438e-38, -1.0000000e+00]]], dtype="float32")])
scale_a=10.0
scale_b=1.0
and add the same with native paddle
import paddle
x = paddle.to_tensor([[[-1.0000000e+00, -1.0000000e+00],
[-1.0000000e+00, -1.0000000e+00],
[-1.0000000e+00, -1.0000000e+00],
[-1.0000000e+00, -1.0000000e+00]],
[[-9.0909090e+00, -1.2930438e-38],
[-1.8302815e-38, -2.3399685e-38],
[-1.2930438e-38, -1.9542594e-38],
[-1.2930438e-38, -1.0000000e+00]]], dtype="float32")
scale_a=10.0
scale_b=1.0
print(paddle.stanh(x, scale_a, scale_b))
and you will see the value difference and why the test failed as ivy's paddle frontend's behaviour differs from native paddle.
My point is try to reconstruct the failing example from the falsifying examples provided in the logs and this way you can always reproduce and debug quickly. Thank you very much :)
Hey @Ishticode, I just updated the backend paddle code to accept |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
now it seems to behave well :) haha
Thanks @ZJay07 for the fix
PR Description
Failing because of exp returning NaN or inf due to large x, scale_a, scale_b values. Fixed by limit those values from being too large
Related Issue
Close #28492
Close #28547
Close #28546
Close #28545
Close #28544
Checklist
Socials