the x comes from the output of a linear network, then I apply this function on x to get the dist, use this dist as an input of other linear networks. The weight I am trying to update is the weight and bias of the network