Yeah I mean you can either clip the weights after some number of gradient updates or you can add a deviation of the weights from your desired value as an extra term added to the model loss function - sort of a lagrangian approach with a penalty on that deviation resulting in a more loose or more strict implicit constraint. It depends on the problem but the lagrangian approach is probably better in most case (it’s basically what you do with regularization/sparsity instead of directly imposing sparsity on weights).