optax.projections.projection_halfspace#
- optax.projections.projection_halfspace(x: Any, a: Any, b: jax.typing.ArrayLike) Any[source]#
Projection onto a halfspace.
Projects a tree
xonto the halfspace defined by a treeaand scalarb.\[\operatorname{argmin}_y \|x - y\|_2^2 \quad \text{subject to} \quad \langle a, y \rangle \leq b\]- Parameters:
x โ tree to project.
a โ tree defining halfspace onto which to project. Must have the same structure as
x.b โ scalar defining halfspace onto which to project.
- Returns:
tree with the same structure as
x.