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

TypeError: get_problem_data() got an unexpected keyword argument 'solver_opts' #152

Open
liw128 opened this issue Oct 26, 2023 · 1 comment

Comments

@liw128
Copy link

liw128 commented Oct 26, 2023

When running the example code

import cvxpy as cp
import torch
from cvxpylayers.torch import CvxpyLayer

n, m = 2, 3
x = cp.Variable(n)
A = cp.Parameter((m, n))
b = cp.Parameter(m)
constraints = [x >= 0]
objective = cp.Minimize(0.5 * cp.pnorm(A @ x - b, p=1))
problem = cp.Problem(objective, constraints)
assert problem.is_dpp()

cvxpylayer = CvxpyLayer(problem, parameters=[A, b], variables=[x])
A_tch = torch.randn(m, n, requires_grad=True)
b_tch = torch.randn(m, requires_grad=True)

# solve the problem
solution, = cvxpylayer(A_tch, b_tch)

# compute the gradient of the sum of the solution with respect to A, b
solution.sum().backward()

I encounter the following error :

solution.sum().backward()Traceback (most recent call last):
File "D:\LYW_WORKPLACE_20220420\test.py", line 14, in
cvxpylayer = CvxpyLayer(problem, parameters=[A, b], variables=[x])
File "C:\Users\LYW\AppData\Roaming\Python\Python38\site-packages\cvxpylayers\torch\cvxpylayer.py", line 114, in init
data, _, _ = problem.get_problem_data(
TypeError: get_problem_data() got an unexpected keyword argument 'solver_opts'

There are similar problems when running other codes. Any idea to overcome this issue ?

@xuwkk
Copy link

xuwkk commented Nov 15, 2023

Using an earlier version solves the problem.

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

2 participants