class_docstr: Base class for multi-task Gaussian Likelihoods, supporting general heteroskedastic noise models.
  
  :param num_tasks: Number of tasks.
  :param noise_covar: A model for the noise covariance. This can be a simple homoskedastic noise model, or a GP
      that is to be fitted on the observed measurement errors.
  :param rank: The rank of the task noise covariance matrix to fit. If `rank`
      is set to 0, then a diagonal covariance matrix is fit.
  :param task_correlation_prior: Prior to use over the task noise correlation
      matrix. Only used when :math:`\text{rank} > 0`.
  :param batch_shape: Number of batches.
class_docstr_tok: ["Base","class","for","multi-task","Gaussian","Likelihoods",",","supporting","general","heteroskedastic","noise","models",".",":","param","num_tasks",":","Number","of","tasks",".",":","param","noise_covar",":","A","model","for","the","noise","covariance",".","This","can","be","a","simple","homoskedastic","noise","model",",","or","a","GP","that","is","to","be","fitted","on","the","observed","measurement","errors",".",":","param","rank",":","The","rank","of","the","task","noise","covariance","matrix","to","fit",".","If","`","rank","`","is","set","to","0",",","then","a","diagonal","covariance","matrix","is","fit",".",":","param","task_correlation_prior",":","Prior","to","use","over","the","task","noise","correlation","matrix",".","Only","used","when",":","math",":","`","\\text","{","rank","}",">","0","`",".",":","param","batch_shape",":","Number","of","batches","."]
code: def _shaped_noise_covar(
      self,
      shape: torch.Size,
      add_noise: Optional[bool] = True,
      interleaved: bool = True,
      *params: Any,
      **kwargs: Any,
  ) -> LinearOperator:
      if not self.has_task_noise:
          noise = ConstantDiagLinearOperator(
              self.noise, diag_shape=shape[-2] * self.num_tasks
          )
          return noise
  
      if self.rank == 0:
          task_noises = self.raw_task_noises_constraint.transform(
              self.raw_task_noises
          )
          task_var_lt = DiagLinearOperator(task_noises)
          dtype, device = task_noises.dtype, task_noises.device
          ckl_init = KroneckerProductDiagLinearOperator
      else:
          task_noise_covar_factor = self.task_noise_covar_factor
          task_var_lt = RootLinearOperator(task_noise_covar_factor)
          dtype, device = (
              task_noise_covar_factor.dtype,
              task_noise_covar_factor.device,
          )
          ckl_init = KroneckerProductLinearOperator
  
      eye_lt = ConstantDiagLinearOperator(
          torch.ones(*shape[:-2], 1, dtype=dtype, device=device),
          diag_shape=shape[-2],
      )
      task_var_lt = task_var_lt.expand(
          *shape[:-2], *task_var_lt.matrix_shape
      )  # pyre-ignore[6]
  
      # to add the latent noise we exploit the fact that
      # I \kron D_T + \sigma^2 I_{NT} = I \kron (D_T + \sigma^2 I)
      # which allows us to move the latent noise inside the task dependent noise
      # thereby allowing exploitation of Kronecker structure in this likelihood.
      if add_noise and self.has_global_noise:
          noise = ConstantDiagLinearOperator(
              self.noise, diag_shape=task_var_lt.shape[-1]
          )
          task_var_lt = task_var_lt + noise
  
      if interleaved:
          covar_kron_lt = ckl_init(eye_lt, task_var_lt)
      else:
          covar_kron_lt = ckl_init(task_var_lt, eye_lt)
  
      return covar_kron_lt
  
imports: from typing import Any, Optional, Union
  import torch
  from linear_operator import to_linear_operator
  from linear_operator.operators import ConstantDiagLinearOperator, DiagLinearOperator, KroneckerProductDiagLinearOperator, KroneckerProductLinearOperator, LinearOperator, RootLinearOperator
  from torch import Tensor
  from torch.distributions import Normal
  from ..constraints import GreaterThan, Interval
  from ..distributions import base_distributions, MultitaskMultivariateNormal
  from ..lazy import LazyEvaluatedKernelTensor
  from ..likelihoods import _GaussianLikelihoodBase, Likelihood
  from ..priors import Prior
  from .noise_models import FixedGaussianNoise, Noise
label_desc: Use image node_id 4 for calling the _MultitaskGaussianLikelihoodBase obj's underlying member method code with example usage: obj._shaped_noise_covar(shape, add_noise, interleaved) and returns: covar_kron_lt, noise