jaxopt.projection.projection_l2_ball

jaxopt.projection.projection_l2_ball(x, max_value=1.0)[source]

Projection onto the l2 ball:

\[\underset{y}{\text{argmin}} ~ ||x - y||_2^2 \quad \textrm{subject to} \quad ||y||_2 \le \text{max_value}\]
Parameters
  • x (Any) – pytree to project.

  • max_value (float) – radius of the ball.

Return type

Any

Returns

output pytree, with the same structure as x.