b2951813547426828d313a80c52de8a619e99731,gpytorch/lazy/constant_mul_lazy_tensor.py,ConstantMulLazyTensor,__init__,#ConstantMulLazyTensor#Any#Any#,56

Before Change



    def __init__(self, base_lazy_tensor, constant):
        if torch.is_tensor(constant):
            if constant.ndimension() > 1:
                raise RuntimeError(
                    "Got a constant with %d dimensions - expected a 0D or 1D tensor" % constant.ndimension()
                )
            elif constant.numel() > 1:
                if not (base_lazy_tensor.ndimension() == 3 and base_lazy_tensor.size(0) == constant.numel()):
                    numel = constant.numel()
                    raise RuntimeError(
                        "A constant with size %d expedts a 3D lazy var. with batch size %d. "
                        "Got a %dD lazy var. with size %s"
                        % (numel, numel, base_lazy_tensor.ndimension(), repr(base_lazy_tensor.size()))

After Change



        // Make sure that the constant can be expanded to the appropriate size
        try:
            constant = orig_constant.expand(base_lazy_tensor.batch_shape)
        except RuntimeError:
            raise RuntimeError(
                "ConstantMulLazyTensor of size {} received an invalid constant of size {}.".format(
                    base_lazy_tensor.shape, orig_constant.shape
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 5

Instances


Project Name: cornellius-gp/gpytorch
Commit Name: b2951813547426828d313a80c52de8a619e99731
Time: 2018-11-26
Author: gpleiss@gmail.com
File Name: gpytorch/lazy/constant_mul_lazy_tensor.py
Class Name: ConstantMulLazyTensor
Method Name: __init__


Project Name: cornellius-gp/gpytorch
Commit Name: 23973f45c189d3cbe34645350cd4f670f7999272
Time: 2019-03-18
Author: gpleiss@gmail.com
File Name: gpytorch/lazy/cat_lazy_tensor.py
Class Name: CatLazyTensor
Method Name: _matmul


Project Name: cornellius-gp/gpytorch
Commit Name: b0eecef1c8acdfe6e65f1e96ff6e26d2bc43e7db
Time: 2018-11-09
Author: balandat@fb.com
File Name: gpytorch/lazy/diag_lazy_tensor.py
Class Name: DiagLazyTensor
Method Name: _quad_form_derivative