# Buggy code
def __init__(
    self,
    has_lengthscale=False,
    ard_num_dims=None,
    batch_size=1,
    active_dims=None,
    lengthscale_prior=None,
    param_transform=softplus,
    inv_param_transform=None,
    eps=1e-6,
    **kwargs,
):
    lengthscale_prior = _deprecate_kwarg(
        kwargs, "log_lengthscale_prior", "lengthscale_prior", lengthscale_prior
    )
    super(Kernel, self).__init__()
    if active_dims is not None and not torch.is_tensor(active_dims):
        active_dims = torch.tensor(active_dims, dtype=torch.long)
    self.register_buffer("active_dims", active_dims)
    self.ard_num_dims = ard_num_dims
    self.batch_size = batch_size
    self.__has_lengthscale = has_lengthscale
    self._param_transform = param_transform
    self._inv_param_transform = _get_inv_param_transform(
        param_transform, inv_param_transform
    )
    if has_lengthscale:
        self.eps = eps
        lengthscale_num_dims = 1 if ard_num_dims is None else ard_num_dims
        self.register_parameter(
            name="raw_lengthscale",
            parameter=torch.nn.Parameter(
                torch.zeros(batch_size, 1, lengthscale_num_dims)
            ),
        )
        if lengthscale_prior is not None:
            self.register_prior(
                "lengthscale_prior",
                lengthscale_prior,
                lambda: self.lengthscale,
                lambda v: self._set_lengthscale(v),
            )

    # TODO: Remove this on next official PyTorch release.
    self.__pdist_supports_batch = True


# Traceback (TypeError)
import gpytorch
gl = gpytorch.likelihoods.GaussianLikelihood()
gl.initialize(noise=1)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File ".../gpytorch/gpytorch/module.py", line 89, in initialize
setattr(self, name, val)
File "../lib/python3.6/site-packages/torch/nn/modules/module.py", line 579, in __setattr__
object.__setattr__(self, name, value)
File ".../gpytorch/gpytorch/likelihoods/gaussian_likelihood.py", line 63, in noise
self.noise_covar.initialize(value)
TypeError: initialize() takes 1 positional argument but 2 were given

# Fixed code
def __init__(
    self,
    has_lengthscale=False,
    ard_num_dims=None,
    batch_size=1,
    active_dims=None,
    lengthscale_prior=None,
    param_transform=softplus,
    inv_param_transform=None,
    eps=1e-6,
    **kwargs,
):
    super(Kernel, self).__init__()
    if active_dims is not None and not torch.is_tensor(active_dims):
        active_dims = torch.tensor(active_dims, dtype=torch.long)
    self.register_buffer("active_dims", active_dims)
    self.ard_num_dims = ard_num_dims
    self.batch_size = batch_size
    self.__has_lengthscale = has_lengthscale
    self._param_transform = param_transform
    self._inv_param_transform = _get_inv_param_transform(
        param_transform, inv_param_transform
    )
    if has_lengthscale:
        self.eps = eps
        lengthscale_num_dims = 1 if ard_num_dims is None else ard_num_dims
        self.register_parameter(
            name="raw_lengthscale",
            parameter=torch.nn.Parameter(
                torch.zeros(batch_size, 1, lengthscale_num_dims)
            ),
        )
        if lengthscale_prior is not None:
            self.register_prior(
                "lengthscale_prior",
                lengthscale_prior,
                lambda: self.lengthscale,
                lambda v: self._set_lengthscale(v),
            )

    # TODO: Remove this on next official PyTorch release.
    self.__pdist_supports_batch = True