docstr: Posterior class for a Kronecker Multi-task GP model using with ICM kernel.
  Extends the standard GPyTorch posterior class by overwriting the rsample
  method. In general, this posterior should ONLY be used for MTGP models
  that have structured covariances. It should also only be used internally when
  called from the `KroneckerMultiTaskGP.posterior(...)` method.
  
  Args:
      distribution: Posterior multivariate normal distribution.
      joint_covariance_matrix: Joint test train covariance matrix over the entire
          tensor.
      train_train_covar: Covariance matrix of train points in the data space.
      test_obs_covar: Covariance matrix of test x train points in the data space.
      train_diff: Difference between train mean and train responses.
      train_noise: Training noise covariance.
      test_noise: Only used if posterior should contain observation noise.
          Testing noise covariance.
docstr_tok: ["Posterior","class","for","a","Kronecker","Multi-task","GP","model","using","with","ICM","kernel",".","Extends","the","standard","GPyTorch","posterior","class","by","overwriting","the","rsample","method",".","In","general",",","this","posterior","should","ONLY","be","used","for","MTGP","models","that","have","structured","covariances",".","It","should","also","only","be","used","internally","when","called","from","the","`","KroneckerMultiTaskGP.posterior","(","...",")","`","method",".","Args",":","distribution",":","Posterior","multivariate","normal","distribution",".","joint_covariance_matrix",":","Joint","test","train","covariance","matrix","over","the","entire","tensor",".","train_train_covar",":","Covariance","matrix","of","train","points","in","the","data","space",".","test_obs_covar",":","Covariance","matrix","of","test","x","train","points","in","the","data","space",".","train_diff",":","Difference","between","train","mean","and","train","responses",".","train_noise",":","Training","noise","covariance",".","test_noise",":","Only","used","if","posterior","should","contain","observation","noise",".","Testing","noise","covariance","."]
code: def __init__(
      self,
      distribution: MultivariateNormal,
      joint_covariance_matrix: LinearOperator,
      test_train_covar: LinearOperator,
      train_diff: Tensor,
      test_mean: Tensor,
      train_train_covar: LinearOperator,
      train_noise: Union[LinearOperator, Tensor],
      test_noise: Optional[Union[LinearOperator, Tensor]] = None,
  ):
      r"""
      Posterior class for a Kronecker Multi-task GP model using with ICM kernel.
      Extends the standard GPyTorch posterior class by overwriting the rsample
      method. In general, this posterior should ONLY be used for MTGP models
      that have structured covariances. It should also only be used internally when
      called from the `KroneckerMultiTaskGP.posterior(...)` method.
  
      Args:
          distribution: Posterior multivariate normal distribution.
          joint_covariance_matrix: Joint test train covariance matrix over the entire
              tensor.
          train_train_covar: Covariance matrix of train points in the data space.
          test_obs_covar: Covariance matrix of test x train points in the data space.
          train_diff: Difference between train mean and train responses.
          train_noise: Training noise covariance.
          test_noise: Only used if posterior should contain observation noise.
              Testing noise covariance.
      """
      super().__init__(distribution=distribution)
      self._is_mt = True
  
      self.joint_covariance_matrix = joint_covariance_matrix
      self.test_train_covar = test_train_covar
      self.train_diff = train_diff
      self.test_mean = test_mean
      self.train_train_covar = train_train_covar
      self.train_noise = train_noise
      self.test_noise = test_noise
      self.observation_noise = self.test_noise is not None
  
      self.num_train = self.train_diff.shape[-2]
      # The following assumes test_train_covar is a SumLinearOperator. TODO: Improve
      self.num_tasks = self.test_train_covar.linear_ops[-1].shape[-1]
  
file_path: botorch/botorch/posteriors/multitask.py
imports: from typing import Optional, Tuple, Union
  import torch
  from botorch.exceptions.errors import BotorchTensorDimensionError
  from botorch.posteriors.gpytorch import GPyTorchPosterior
  from gpytorch.distributions import MultivariateNormal
  from linear_operator.operators import LinearOperator, to_linear_operator
  from torch import Tensor
label_desc: Use image node_id 1 to create a new MultitaskGPPosterior object from inherited base classes: GPyTorchPosterior with example: obj = MultitaskGPPosterior(distribution, joint_covariance_matrix, test_train_covar, train_diff, test_mean, train_train_covar, train_noise, test_noise)