cvxgrp / cvxpylayers

Differentiable convex optimization layers
Apache License 2.0
1.82k stars 162 forks source link

Getting dx/dp instead of df/dp #155

Open Zhuojun-PhD opened 9 months ago

Zhuojun-PhD commented 9 months ago

Hello,

Thanks for the package!

I am trying to retrieve the gradient of the optimal decision with respect to a parameter $\theta$, i.e., $\nabla_\theta x$. I established a toy problem in order to compute $\nabla_k x$:

image

However, if I understand correctly, the dimension of $\nabla_k x$ should be $\mathbb{R}^n$.

So I am curious that if there is any way I get retrieve $\nabla_k x$ instead of $\nabla_k f(x)$?

Thanks for the reply in advance, Zhuojun