Add --solver argparse option to example scripts#229
Draft
sbarratt wants to merge 3 commits into
Draft
Conversation
Explicitly opt out of sparse tensor invariant checks when converting scipy CSR matrices to torch CSR tensors. The input from scipy already guarantees sorted, deduplicated indices, so the checks are unnecessary. This silences the PyTorch UserWarning about implicit invariant check state.
Remove old jax_example.py and tutorial.ipynb, replace with 5 self-contained examples matching the PyTorch set: - hello_world: differentiate through least-squares, compare with jnp.linalg.lstsq - batching: batched least-squares in one call - lqr: learn LQR value function via trajectory rollouts (BPTT) - optimal_transport: sensitivity analysis of entropy-regularized OT - signal_denoising: learn TV denoising params with optax Adam Add run_example.sh with ./run_example.sh all support. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Remove hardcoded solver and device-specific code from examples. Solver is now configurable via --solver flag (DIFFCP, MOREAU, CUCLARABEL, MPAX). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
solver=cp.CUCLARABELand GPU/device-specific code fromtorch_example.pyandjax_example.py--solverargparse flag so users can choose any supported solver (DIFFCP, MOREAU, CUCLARABEL, MPAX)--solveris not specifiedTest plan
python examples/torch/torch_example.py(default solver)python examples/torch/torch_example.py --solver MOREAUpython examples/jax/jax_example.py(default solver)python examples/jax/jax_example.py --solver MOREAU🤖 Generated with Claude Code