-
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
Driver handling in svdvals function in torch_frontend #23718
Changes from 3 commits
699e80b
337870c
8137331
da90906
791b7e8
3841366
a4a8a41
f8eff89
997c5c6
5df4c6e
17a6f66
fb6bdcd
0749056
e891edd
ec4c9c3
ea0e331
d55430d
a9e575a
adb7cc5
71027ba
ffc36e7
df5368b
b31bb95
468b869
b47923e
c0fa649
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
# local | ||
import math | ||
import torch | ||
import ivy | ||
import ivy.functional.frontends.torch as torch_frontend | ||
from ivy.functional.frontends.torch.func_wrapper import to_ivy_arrays_and_back | ||
|
@@ -310,6 +311,12 @@ def svd(A, /, *, full_matrices=True, driver=None, out=None): | |
) | ||
def svdvals(A, *, driver=None, out=None): | ||
# TODO: add handling for driver | ||
if driver == "gesvd": | ||
return torch.linalg.svdvals(A, out=out, driver=driver) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hey! I think this could be simplified into There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i have added the test and simplified the function implmentaiton There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the test should be modified in |
||
elif driver == "gesvdj": | ||
return torch.linalg.svdvals(A, out=out, driver=driver) | ||
elif driver == "gesvda": | ||
return torch.linalg.svdvals(A, out=out, driver=driver) | ||
return ivy.svdvals(A, out=out) | ||
|
||
|
||
|
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.
Hey! The native torch shouldn't be imported in the frontends, if
ivy.svdvals
doesn't support this argument yet, you should first implement the new argument in the backend, add the related argument in the tests, and then use the ivy function in this frontend, thanks!