Skip to content
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

Add cpu kernel of new api : lstsq #38585

Merged
merged 5 commits into from
Dec 30, 2021
Merged

Add cpu kernel of new api : lstsq #38585

merged 5 commits into from
Dec 30, 2021

Conversation

haohongxiang
Copy link
Contributor

@haohongxiang haohongxiang commented Dec 29, 2021

PR types

New features

PR changes

APIs

Describe

Add cpu kernel of new api : lstsq

@paddle-bot-old
Copy link

Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

Copy link
Contributor

@zhwesky2010 zhwesky2010 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm for parallel_UT_rule.py

res_singular_values = results[3].numpy()

if x.shape[-2] > x.shape[-1] and self._output_rank == x.shape[-1]:
if (np.abs(res_residuals - self._output_residuals) < 1e-6).any():
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use np.allclose instead of np.abs and any ? generally, set rtol/atol to 1e-6/0
the same as other np.abs below

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I will fix them in next PR.

fetch_list=[results])

if x.shape[-2] > x.shape[-1] and self._output_rank == x.shape[-1]:
if (np.abs(fetches[1] - self._output_residuals) < 1e-6).any():
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use np.allclose instead of np.abs and any ? generally, set rtol/atol to 1e-6/0
the same as other np.abs below

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I will fix them in next PR.

Copy link
Contributor

@qingqing01 qingqing01 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no GPU implementation?

@@ -2503,3 +2502,107 @@ def __check_input(x, UPLO):
attrs={'UPLO': UPLO,
'is_test': is_test})
return out_value


def lstsq(x, y, rcond=1e-15, driver=None, name=None):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add comments

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The imlementation of GPU kernel and docs will be added in next PR.

self.rcond = 1e-15
self.driver = "gelss"
self._input_shape_1 = (50, 600)
self._input_shape_2 = (50, 300)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The UT need to check the compute correctness

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The correctness of computation is checked in UT.

Copy link
Contributor

@jeff41404 jeff41404 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ForFishes ForFishes merged commit ccf99b6 into PaddlePaddle:develop Dec 30, 2021
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.

7 participants