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

AttributeError: module 'torch.linalg' has no attribute 'lu_factor' #57

Open
yufei0726 opened this issue Nov 6, 2024 · 0 comments
Open

Comments

@yufei0726
Copy link

I encountered this problem when calling QPfunction when building an autonomous driving path tracking problem, but I printed and saw that the eigenvalues ​​of the Q matrix were all positive and there were no diagonal zero elements. I hope someone can answer this question
Traceback (most recent call last):
File "C:\ProgramData\anaconda3\envs\dQP\lib\site-packages\qpth\solvers\pdipm\batch.py", line 380, in pre_factor_kkt
Q_LU = lu_hack(Q)
File "C:\ProgramData\anaconda3\envs\dQP\lib\site-packages\qpth\solvers\pdipm\batch.py", line 9, in lu_hack
data, pivots = torch.linalg.lu_factor(x, pivot=not x.is_cuda)
AttributeError: module 'torch.linalg' has no attribute 'lu_factor'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "runcarsim1.py", line 114, in
sys.exit(main())
File "runcarsim1.py", line 55, in main
control = controller(traj_ref, current_state)
File "C:\ProgramData\anaconda3\envs\dQP\lib\site-packages\torch\nn\modules\module.py", line 1102, in _call_impl
return forward_call(*input, **kwargs)
File "D:\syf\differentiable-control\QPnet.py", line 44, in forward
x = self.dQP(traj_ref, current_state)
File "D:\syf\differentiable-control\QPnet.py", line 231, in dQP
deltU = QPFunction(verbose = 0)(Q_obj.double(), P_obj.double(), G.double(), h.double(), e, e)
File "C:\ProgramData\anaconda3\envs\dQP\lib\site-packages\qpth\qp.py", line 93, in forward
ctx.Q_LU, ctx.S_LU, ctx.R = pdipm_b.pre_factor_kkt(Q, G, A)
File "C:\ProgramData\anaconda3\envs\dQP\lib\site-packages\qpth\solvers\pdipm\batch.py", line 382, in pre_factor_kkt
raise RuntimeError("""
RuntimeError:
qpth Error: Cannot perform LU factorization on Q.
Please make sure that your Q matrix is PSD and has
a non-zero diagonal.

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

No branches or pull requests

1 participant