def __init__(self, f, df, x0, names=None, *args, **kwargs):
super(GradientChecker, self).__init__(name='<STR_LIT>')<EOL>if isinstance(x0, (list, tuple)) and names is None:<EOL><INDENT>self.shapes = [get_shape(xi) for xi in x0]<EOL>self.names = ['<STR_LIT>'.format(i=i) for i in range(len(x0))]<EOL><DEDENT>elif isinstance(x0, (list, tuple)) and names is not None:<EOL><INDENT>self.shapes = [get_shape(xi) for xi in x0]<EOL>self.names = names<EOL><DEDENT>elif names is None:<EOL><INDENT>self.names = ['<STR_LIT:X>']<EOL>self.shapes = [get_shape(x0)]<EOL><DEDENT>else:<EOL><INDENT>self.names = names<EOL>self.shapes = [get_shape(x0)]<EOL><DEDENT>for name, xi in zip(self.names, at_least_one_element(x0)):<EOL><INDENT>self.__setattr__(name, Param(name, xi))<EOL>self.link_parameter(self.__getattribute__(name))<EOL>
:param f: Function to check gradient for
:param df: Gradient of function to check
:param x0:
    Initial guess for inputs x (if it has a shape (a,b) this will be reflected in the parameter names).
    Can be a list of arrays, if takes a list of arrays. This list will be passed
    to f and df in the same order as given here.
    If only one argument, make sure not to pass a list!!!

:type x0: [array-like] | array-like | float | int
:param names:
    Names to print, when performing gradcheck. If a list was passed to x0
    a list of names with the same length is expected.
:param args: Arguments passed as f(x, *args, **kwargs) and df(x, *args, **kwargs)

Examples:
---------
    from GPy.models import GradientChecker
    N, M, Q = 10, 5, 3

    Sinusoid:

        X = numpy.random.rand(N, Q)
        grad = GradientChecker(numpy.sin,numpy.cos,X,'x')
        grad.checkgrad(verbose=1)

    Using GPy:

        X, Z = numpy.random.randn(N,Q), numpy.random.randn(M,Q)
        kern = GPy.kern.linear(Q, ARD=True) + GPy.kern.rbf(Q, ARD=True)
        grad = GradientChecker(kern.K,
                               lambda x: 2*kern.dK_dX(numpy.ones((1,1)), x),
                               x0 = X.copy(),
                               names='X')
        grad.checkgrad(verbose=1)
        grad.randomize()
        grad.checkgrad(verbose=1)