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 paddle.linalg.solve OP #35715

Merged

Conversation

veyron95
Copy link
Contributor

@veyron95 veyron95 commented Sep 14, 2021

PR types

New features

PR changes

OPs

Describe

This PR supports linalg.solve calculation for linear algorithm module of Paddle. One may call paddle.linalg.solve to use it.

An example is listed below, which is a python3 script:

 import paddle
 import numpy as np
  
 np_x = np.array([[3, 1],[1, 2]])
 np_y = np.array([9, 8])
 x = paddle.to_tensor(np_x, dtype="float64")
 y = paddle.to_tensor(np_y, dtype="float64")
 out = paddle.linalg.solve(x, y)  
 print(out)
 # [2., 3.])  

@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

@JiabinYang JiabinYang left a comment

Choose a reason for hiding this comment

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

some comments

paddle/fluid/operators/math/matrix_solve.cu.cc Outdated Show resolved Hide resolved
paddle/fluid/operators/math/matrix_solve.cu.cc Outdated Show resolved Hide resolved
paddle/fluid/operators/math/matrix_solve.cu.cc Outdated Show resolved Hide resolved
paddle/fluid/operators/math/matrix_solve.cu.cc Outdated Show resolved Hide resolved
paddle/fluid/operators/math/matrix_solve.cu.cc Outdated Show resolved Hide resolved
paddle/fluid/operators/math/matrix_solve.cu.cc Outdated Show resolved Hide resolved
paddle/fluid/operators/solve_op.h Show resolved Hide resolved
JiabinYang
JiabinYang previously approved these changes Sep 18, 2021
Copy link
Contributor

@JiabinYang JiabinYang left a comment

Choose a reason for hiding this comment

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

LGTM

lanxianghit
lanxianghit previously approved these changes Sep 22, 2021
python/paddle/__init__.py Outdated Show resolved Hide resolved
python/paddle/tensor/linalg.py Show resolved Hide resolved
python/paddle/tensor/linalg.py Show resolved Hide resolved
python/paddle/tensor/linalg.py Show resolved Hide resolved
python/paddle/tensor/linalg.py Show resolved Hide resolved
Copy link
Contributor

@XieYunshen XieYunshen left a comment

Choose a reason for hiding this comment

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

LGTM

@JiabinYang JiabinYang merged commit 8caf951 into PaddlePaddle:develop Sep 24, 2021
veyron95 added a commit to veyron95/Paddle that referenced this pull request Sep 24, 2021
* Add linalg.solve op, test=develop

* Fix a bug caused by accidental deletion

* updated description and fix a bug: missing a comma

* Add linalg.solve op, test=develop

* updated solve op backward logic

* updated solve op backward logic again

* Add linalg.solve Op, test=develop

* Updated and modified to fit CI requirements

* Fix a bug

* 1)Add more test cases; 2)Fix a wrong usage in reduces operation; 3)Remove redundant code

* Remove redundant comments

* 1)Removed redundant code; 2)Updated to enhance code robustness

* Removed redundant code

* Updated API documents
lanxianghit pushed a commit that referenced this pull request Sep 26, 2021
This PR supports linalg.solve calculation for linear algorithm module of Paddle. One may call paddle.linalg.solve to use it.
AnnaTrainingG pushed a commit to AnnaTrainingG/Paddle that referenced this pull request Sep 29, 2021
* Add linalg.solve op, test=develop

* Fix a bug caused by accidental deletion

* updated description and fix a bug: missing a comma

* Add linalg.solve op, test=develop

* updated solve op backward logic

* updated solve op backward logic again

* Add linalg.solve Op, test=develop

* Updated and modified to fit CI requirements

* Fix a bug

* 1)Add more test cases; 2)Fix a wrong usage in reduces operation; 3)Remove redundant code

* Remove redundant comments

* 1)Removed redundant code; 2)Updated to enhance code robustness

* Removed redundant code

* Updated API documents
@veyron95 veyron95 deleted the add_solve_op_via_eigen_cublas branch November 12, 2021 03:49
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