optax.projections.projection_l2_ball#
- optax.projections.projection_l2_ball(
- tree: Any,
- scale: jax.typing.ArrayLike = 1,
Projection onto the l2 ball.
This function solves the following constrained optimization problem, where
xis the input tree.\[\underset{y}{\text{argmin}} ~ \|x - y\|_2^2 \quad \textrm{subject to} \quad \|y\|_2 \le \text{scale}\]- Parameters:
tree โ tree to project.
scale โ radius of the ball.
- Returns:
projected tree, with the same structure as
tree.
Added in version 0.2.4.