# Buggy code
def __add__(self, other):
    """
    Return a :obj:`gpytorch.lazy.LazyTensor` that represents the sum of this lazy tensor and another matrix
    or lazy tensor.

    Args:
        :attr:`other` (:obj:`torch.tensor` or :obj:`gpytorch.lazy.LazyTensor`):
            Matrix to add to this one.

    Returns:
        :obj:`gpytorch.lazy.SumLazyTensor`:
            A sum lazy tensor representing the sum of this lazy tensor and other.
    """
    from .sum_lazy_tensor import SumLazyTensor
    from .zero_lazy_tensor import ZeroLazyTensor
    from .diag_lazy_tensor import DiagLazyTensor
    from .added_diag_lazy_tensor import AddedDiagLazyTensor
    from .non_lazy_tensor import lazify
    from torch import Tensor

    if isinstance(other, ZeroLazyTensor):
        return self
    elif isinstance(other, DiagLazyTensor):
        return AddedDiagLazyTensor(self, other)
    elif isinstance(other, Tensor):
        other = lazify(other)
        shape = _mul_broadcast_shape(self.shape, other.shape)
        return SumLazyTensor(self.expand(shape), other.expand(shape))
    else:
        return SumLazyTensor(self, other)


# Traceback (TypeError)
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-16-0d626e17adaf> in <module>
----> 1 cmtlt + torch.randn(100, 100)

~/Documents/GitHub/gpytorch/gpytorch/lazy/lazy_tensor.py in __add__(self, other)
1625             other = lazify(other)
1626             shape = _mul_broadcast_shape(self.shape, other.shape)
-> 1627             return SumLazyTensor(self.expand(shape), other.expand(shape))
1628         else:
1629             return SumLazyTensor(self, other)

~/Documents/GitHub/gpytorch/gpytorch/lazy/lazy_tensor.py in expand(self, *sizes)
857             raise RuntimeError("Invalid arguments {} to expand.".format(sizes))
858
--> 859         res = self._expand_batch(batch_shape=shape[:-2])
860         return res
861

~/Documents/GitHub/gpytorch/gpytorch/lazy/constant_mul_lazy_tensor.py in _expand_batch(self, batch_shape)
70     def _expand_batch(self, batch_shape):
---> 71         return self.__class__(self.base_lazy_tensor._expand_batch(batch_shape), self._constant.expand(*batch_shape))
72
73     def _get_indices(self, row_index, col_index, *batch_indices):

TypeError: expand() missing 1 required positional arguments: "size"

# Fixed code
def __add__(self, other):
    """
    Return a :obj:`gpytorch.lazy.LazyTensor` that represents the sum of this lazy tensor and another matrix
    or lazy tensor.

    Args:
        :attr:`other` (:obj:`torch.tensor` or :obj:`gpytorch.lazy.LazyTensor`):
            Matrix to add to this one.

    Returns:
        :obj:`gpytorch.lazy.SumLazyTensor`:
            A sum lazy tensor representing the sum of this lazy tensor and other.
    """
    from .sum_lazy_tensor import SumLazyTensor
    from .zero_lazy_tensor import ZeroLazyTensor
    from .diag_lazy_tensor import DiagLazyTensor
    from .added_diag_lazy_tensor import AddedDiagLazyTensor
    from .non_lazy_tensor import lazify
    from torch import Tensor

    if isinstance(other, ZeroLazyTensor):
        return self
    elif isinstance(other, DiagLazyTensor):
        return AddedDiagLazyTensor(self, other)
    elif isinstance(other, Tensor):
        other = lazify(other)
        shape = _mul_broadcast_shape(self.shape, other.shape)
        new_self = self if self.shape == shape else self._expand_batch(shape[:-2])
        new_other = other if other.shape == shape else other._expand_batch(shape[:-2])
        return SumLazyTensor(new_self, new_other)
    else:
        return SumLazyTensor(self, other)