optax.projections.projection_non_negative

optax.projections.projection_non_negative#

optax.projections.projection_non_negative(tree: Any) Any[source]#

Projection onto the non-negative orthant.

\[\underset{p}{\text{argmin}} ~ \|x - p\|_2^2 \quad \textrm{subject to} \quad p \ge 0\]

where \(x\) is the input tree.

Parameters:

tree โ€“ tree to project.

Returns:

projected tree, with the same structure as tree.