Solved by tom in post #2 
              
              
                The usual way to do this is to use the functional interface to redefine the forward 
class ConstrainedConv2d(nn.Conv2d):
    def forward(self, input):
        return F.conv2d(input, self.weight.clamp(min=-1.0, max=1.0), self.bias, self.stride,
                        self.padding, self.dilation, sel…