def Clip(x): """Clips x to the range [-1., 1.].""" return math_ops.maximum(math_ops.minimum(x, 1.), -1.)