Erm, I’m probably being very dumb, but I can’t see a simple way of doing this, without defining a new layer class?
That is, what is the simplest way to constrain the weights of a linear layer to [0,1] or [-1,1] - I guess either will work?