gpytorch/likelihoods/noise_models.py
def forward(self, *params, shape=None):
        """In the homoskedastic case, the parameters are only used to infer the required shape.
        Here are the possible scenarios:
        - non-batched noise, non-batched input, non-MT -> noise_diag shape is `n`
        - non-batched noise, non-batched input, MT -> noise_diag shape is `nt`
        - non-batched noise, batched input, non-MT -> noise_diag shape is `b x n` with b' the broadcasted batch shape
        - non-batched noise, batched input, MT -> noise_diag shape is `b x nt`
        - batched noise, non-batched input, non-MT -> noise_diag shape is `b x n`
        - batched noise, non-batched input, MT -> noise_diag shape is `b x nt`
        - batched noise, batched input, non-MT -> noise_diag shape is `b' x n`
        - batched noise, batched input, MT -> noise_diag shape is `b' x nt`
        where `n` is the number of evaluation points and `t` is the number of tasks (i.e. `num_tasks` of self.noise).
        So bascially the shape is always `b' x nt`, with `b'` appropriately broadcast from the noise parameter and
        input batch shapes. `n` and the input batch shape are determined either from the shape arg or from the params
        input. For this it is sufficient to take in a single `shape` arg, with the convention that shape[:-1] is the
        batch shape of the input, and shape[-1] is `n`.
        """
        if shape is None:
            p = params[0] if torch.is_tensor(params[0]) else params[0][0]
            shape = p.shape if len(p.shape) == 1 else p.shape[:-1]
        noise = self.noise
        batch_shape, n = shape[:-1], shape[-1]
        noise_batch_shape = noise.shape[:-1] if noise.shape[-2] > 1 else torch.Size()
        num_tasks = noise.shape[-1]
        batch_shape = _mul_broadcast_shape(noise_batch_shape, batch_shape)
        noise = noise.unsqueeze(-2)
        if len(batch_shape) == 0:
            noise = noise.squeeze(0)
        noise_diag = noise.expand(batch_shape + torch.Size([n, num_tasks])).contiguous()
        if num_tasks == 1:
            noise_diag = noise_diag.view(*batch_shape, n)
        return DiagLazyTensor(noise_diag)
In the homoskedastic case, the parameters are only used to infer the required shape.
        Here are the possible scenarios:
        - non-batched noise, non-batched input, non-MT -> noise_diag shape is `n`
        - non-batched noise, non-batched input, MT -> noise_diag shape is `nt`
        - non-batched noise, batched input, non-MT -> noise_diag shape is `b x n` with b' the broadcasted batch shape
        - non-batched noise, batched input, MT -> noise_diag shape is `b x nt`
        - batched noise, non-batched input, non-MT -> noise_diag shape is `b x n`
        - batched noise, non-batched input, MT -> noise_diag shape is `b x nt`
        - batched noise, batched input, non-MT -> noise_diag shape is `b' x n`
        - batched noise, batched input, MT -> noise_diag shape is `b' x nt`
        where `n` is the number of evaluation points and `t` is the number of tasks (i.e. `num_tasks` of self.noise).
        So bascially the shape is always `b' x nt`, with `b'` appropriately broadcast from the noise parameter and
        input batch shapes. `n` and the input batch shape are determined either from the shape arg or from the params
        input. For this it is sufficient to take in a single `shape` arg, with the convention that shape[:-1] is the
        batch shape of the input, and shape[-1] is `n`.
        
In the homoskedastic case, the parameters are only used to infer the required shape.
In the homoskedastic case the parameters are only used to infer the required shape .
def forward(self, *params, shape=None):
        if shape is None:
            p = params[0] if torch.is_tensor(params[0]) else params[0][0]
            shape = p.shape if len(p.shape) == 1 else p.shape[:-1]
        noise = self.noise
        batch_shape, n = shape[:-1], shape[-1]
        noise_batch_shape = noise.shape[:-1] if noise.shape[-2] > 1 else torch.Size()
        num_tasks = noise.shape[-1]
        batch_shape = _mul_broadcast_shape(noise_batch_shape, batch_shape)
        noise = noise.unsqueeze(-2)
        if len(batch_shape) == 0:
            noise = noise.squeeze(0)
        noise_diag = noise.expand(batch_shape + torch.Size([n, num_tasks])).contiguous()
        if num_tasks == 1:
            noise_diag = noise_diag.view(*batch_shape, n)
        return DiagLazyTensor(noise_diag)
def forward ( self , * params , shape = None ) : if shape is None : p = params [ 0 ] if torch . is_tensor ( params [ 0 ] ) else params [ 0 ] [ 0 ] shape = p . shape if len ( p . shape ) == 1 else p . shape [ : - 1 ] noise = self . noise batch_shape , n = shape [ : - 1 ] , shape [ - 1 ] noise_batch_shape = noise . shape [ : - 1 ] if noise . shape [ - 2 ] > 1 else torch . Size ( ) num_tasks = noise . shape [ - 1 ] batch_shape = _mul_broadcast_shape ( noise_batch_shape , batch_shape ) noise = noise . unsqueeze ( - 2 ) if len ( batch_shape ) == 0 : noise = noise . squeeze ( 0 ) noise_diag = noise . expand ( batch_shape + torch . Size ( [ n , num_tasks ] ) ) . contiguous ( ) if num_tasks == 1 : noise_diag = noise_diag . view ( * batch_shape , n ) return DiagLazyTensor ( noise_diag )
In the homoskedastic case, the parameters are only used to infer the required shape.
In the homoskedastic case the parameters are only used to infer the required shape .
"""In the homoskedastic case, the parameters are only used to infer the required shape.
        Here are the possible scenarios:
        - non-batched noise, non-batched input, non-MT -> noise_diag shape is `n`
        - non-batched noise, non-batched input, MT -> noise_diag shape is `nt`
        - non-batched noise, batched input, non-MT -> noise_diag shape is `b x n` with b' the broadcasted batch shape
        - non-batched noise, batched input, MT -> noise_diag shape is `b x nt`
        - batched noise, non-batched input, non-MT -> noise_diag shape is `b x n`
        - batched noise, non-batched input, MT -> noise_diag shape is `b x nt`
        - batched noise, batched input, non-MT -> noise_diag shape is `b' x n`
        - batched noise, batched input, MT -> noise_diag shape is `b' x nt`
        where `n` is the number of evaluation points and `t` is the number of tasks (i.e. `num_tasks` of self.noise).
        So bascially the shape is always `b' x nt`, with `b'` appropriately broadcast from the noise parameter and
        input batch shapes. `n` and the input batch shape are determined either from the shape arg or from the params
        input. For this it is sufficient to take in a single `shape` arg, with the convention that shape[:-1] is the
        batch shape of the input, and shape[-1] is `n`.
        """
self
shape