def METHOD_NAME(self, X, Z=None):
    r"""
    Returns :math:`\|\frac{X-Z}{l}\|^2`.
    """
    if Z is None:
        Z = X
    X = self._slice_input(X)
    Z = self._slice_input(Z)
    if X.size(1) != Z.size(1):
        raise ValueError("Inputs must have the same number of features.")
    scaled_X = X / self.lengthscale
    scaled_Z = Z / self.lengthscale
    X2 = (scaled_X**2).sum(1, keepdim=True)
    Z2 = (scaled_Z**2).sum(1, keepdim=True)
    XZ = scaled_X.matmul(scaled_Z.t())
    r2 = X2 - 2 * XZ + Z2.t()
    return r2.clamp(min=0)