def gradients_X(self, dL_dF, X):
        x = X.flatten()

        #outside the range of the breakpoints, the function is just offset by a contant, so the partial derivative is 1.
        dL_dX = dL_dF.copy().flatten()

        #insude the breakpoints, the partial derivative is self.grads
        for low, up, g, v in zip(self. sorted_breaks[:-1], self.sorted_breaks[1:], self.grads, self.sorted_values[:-1]):
            i = np.logical_and(x>low, x<up)
            dL_dX[i] = dL_dF[i]*g

        return dL_dX.reshape(-1,1)
dataset/ETHPy150Open SheffieldML/GPy/GPy/mappings/piecewise_linear.py/PiecewiseLinear.gradients_X/original