CVXPYlayers is a Python library for constructing differentiable convex optimization layers in PyTorch and JAX. CVXPYlayers 1.0 supports keeping the data on the GPU with the CuClarabel backend.
This library accompanies our NeurIPS 2019 paper on differentiable convex optimization layers. For an informal introduction to convex optimization layers, see our blog post.
Our package uses CVXPY for specifying parametrized convex optimization problems.
Use the package manager pip to install cvxpylayers.
pip install cvxpylayersOur package includes convex optimization layers for PyTorch, JAX, and TensorFlow 2.0; the layers are functionally equivalent. You will need to install PyTorch, JAX, or TensorFlow separately, which can be done by following the instructions on their websites.
Additionally, to use the fully GPU-accelerated pathway, install: