Constraint optimization with torch.distributions.constraints.Constraint

Hi, I am new to pytorch.
I have a need for constraint optimization, e.g., non-negativity of nn parameters.
I have searched for solutions and found that most of you suggested manually clipping the values to be larger than zero.

By the way, I find that there is a constraint class torch.distributions.constraints.Constraint.
I am wondering whether and how this class is related to the constraint optimization.
Any help is appreciated!