jaxopt.projection.projection_box
- jaxopt.projection.projection_box(x, hyperparams)[source]
Projection onto box constraints:
\[\underset{p}{\text{argmin}} ~ ||x - p||_2^2 \quad \textrm{subject to} \quad \text{lower} \le p \le \text{upper}\]- Parameters
x (
Any
) – pytree to project.hyperparams (
Tuple
) – a tuplehyperparams = (lower, upper)
, wherelower
andupper
can be either scalar values or pytrees of the same structure asx
.
- Return type
Any
- Returns
projected pytree, with the same structure as
x
.