I would like to enforce the weights to sum to 1, dividing by the sum of the matrix is not enough since each value can be greater then 1.
For example, the following weight matrix is possible:
kernel = torch.FloatTensor([[0,-1,0],[-1,5,-1],[0,-1,0]])
Any idea how can I enforce it?
Thanks a lot!