You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 ?
The text was updated successfully, but these errors were encountered:
When running the example code
I encounter the following error :
There are similar problems when running other codes. Any idea to overcome this issue ?
The text was updated successfully, but these errors were encountered: