def dparam_partial(inst_func, *args):
def param_func(param_val, param_name, inst_func, args):<EOL><INDENT>inst_func.__self__[param_name] = param_val<EOL>return inst_func(*args)<EOL><DEDENT>return functools.partial(param_func, inst_func=inst_func, args=args)<EOL>
If we have a instance method that needs to be called but that doesn't
take the parameter we wish to change to checkgrad, then this function
will change the variable using set params.

inst_func: should be a instance function of an object that we would like
            to change
param: the param that will be given to set_params
args: anything else that needs to be given to the function (for example
      the f or Y that are being used in the function whilst we tweak the
      param