class_docstr: Kernel supporting Kronecker style multitask Gaussian processes (where every data point is evaluated at every
  task) using :class:`gpytorch.kernels.IndexKernel` as a basic multitask kernel.
  
  Given a base covariance module to be used for the data, :math:`K_{XX}`, this kernel computes a task kernel of
  specified size :math:`K_{TT}` and returns :math:`K = K_{TT} \otimes K_{XX}`. as an
  :obj:`~linear_operator.operators.KroneckerProductLinearOperator`.
  
  :param ~gpytorch.kernels.Kernel data_covar_module: Kernel to use as the data kernel.
  :param int num_tasks: Number of tasks
  :param int rank: (default 1) Rank of index kernel to use for task covariance matrix.
  :param ~gpytorch.priors.Prior task_covar_prior: (default None) Prior to use for task kernel.
      See :class:`gpytorch.kernels.IndexKernel` for details.
  :param dict kwargs: Additional arguments to pass to the kernel.
class_docstr_tok: ["Kernel","supporting","Kronecker","style","multitask","Gaussian","processes","(","where","every","data","point","is","evaluated","at","every","task",")","using",":","class",":","`","gpytorch.kernels.IndexKernel","`","as","a","basic","multitask","kernel",".","Given","a","base","covariance","module","to","be","used","for","the","data",",",":","math",":","`","K_","{","XX","}","`",",","this","kernel","computes","a","task","kernel","of","specified","size",":","math",":","`","K_","{","TT","}","`","and","returns",":","math",":","`","K","=","K_","{","TT","}","\\otimes","K_","{","XX","}","`",".","as","an",":","obj",":","`","~linear_operator.operators.KroneckerProductLinearOperator","`",".",":","param","~gpytorch.kernels.Kernel","data_covar_module",":","Kernel","to","use","as","the","data","kernel",".",":","param","int","num_tasks",":","Number","of","tasks",":","param","int","rank",":","(","default","1",")","Rank","of","index","kernel","to","use","for","task","covariance","matrix",".",":","param","~gpytorch.priors.Prior","task_covar_prior",":","(","default","None",")","Prior","to","use","for","task","kernel",".","See",":","class",":","`","gpytorch.kernels.IndexKernel","`","for","details",".",":","param","dict","kwargs",":","Additional","arguments","to","pass","to","the","kernel","."]
code: def forward(
      self, x1, x2, diag=False, last_dim_is_batch=False, **params
  ):
      if last_dim_is_batch:
          raise RuntimeError(
              "MultitaskKernel does not accept the last_dim_is_batch argument."
          )
      covar_i = self.task_covar_module.covar_matrix
      if len(x1.shape[:-2]):
          covar_i = covar_i.repeat(*x1.shape[:-2], 1, 1)
      covar_x = to_linear_operator(
          self.data_covar_module.forward(x1, x2, **params)
      )
      res = KroneckerProductLinearOperator(covar_x, covar_i)
      return res.diagonal(dim1=-1, dim2=-2) if diag else res
  
file_path: gpytorch/gpytorch/kernels/multitask_kernel.py
imports: from typing import Optional
  from linear_operator import to_linear_operator
  from linear_operator.operators import KroneckerProductLinearOperator
  from ..priors import Prior
  from .index_kernel import IndexKernel
  from .kernel import Kernel
label_desc: Use image node_id 2 for calling the MultitaskKernel obj's underlying member method code with example usage: obj.forward(x1, x2, diag, last_dim_is_batch) and returns: unknown