class_docstr: The base class for any Gaussian process latent function to be used in conjunction
  with exact inference.
  
  :param torch.Tensor train_inputs: (size n x d) The training features :math:`\mathbf X`.
  :param torch.Tensor train_targets: (size n) The training targets :math:`\mathbf y`.
  :param ~gpytorch.likelihoods.GaussianLikelihood likelihood: The Gaussian likelihood that defines
      the observational distribution. Since we're using exact inference, the likelihood must be Gaussian.
  
  The :meth:`forward` function should describe how to compute the prior latent distribution
  on a given input. Typically, this will involve a mean and kernel function.
  The result must be a :obj:`~gpytorch.distributions.MultivariateNormal`.
  
  Calling this model will return the posterior of the latent Gaussian process when conditioned
  on the training data. The output will be a :obj:`~gpytorch.distributions.MultivariateNormal`.
  
  Example:
      >>> class MyGP(gpytorch.models.ExactGP):
      >>>     def __init__(self, train_x, train_y, likelihood):
      >>>         super().__init__(train_x, train_y, likelihood)
      >>>         self.mean_module = gpytorch.means.ZeroMean()
      >>>         self.covar_module = gpytorch.kernels.ScaleKernel(gpytorch.kernels.RBFKernel())
      >>>
      >>>     def forward(self, x):
      >>>         mean = self.mean_module(x)
      >>>         covar = self.covar_module(x)
      >>>         return gpytorch.distributions.MultivariateNormal(mean, covar)
      >>>
      >>> # train_x = ...; train_y = ...
      >>> likelihood = gpytorch.likelihoods.GaussianLikelihood()
      >>> model = MyGP(train_x, train_y, likelihood)
      >>>
      >>> # test_x = ...;
      >>> model(test_x)  # Returns the GP latent function at test_x
      >>> likelihood(model(test_x))  # Returns the (approximate) predictive posterior distribution at test_x
class_docstr_tok: ["The","base","class","for","any","Gaussian","process","latent","function","to","be","used","in","conjunction","with","exact","inference",".",":","param","torch.Tensor","train_inputs",":","(","size","n","x","d",")","The","training","features",":","math",":","`","\\mathbf","X","`",".",":","param","torch.Tensor","train_targets",":","(","size","n",")","The","training","targets",":","math",":","`","\\mathbf","y","`",".",":","param","~gpytorch.likelihoods.GaussianLikelihood","likelihood",":","The","Gaussian","likelihood","that","defines","the","observational","distribution",".","Since","we","'re","using","exact","inference",",","the","likelihood","must","be","Gaussian",".","The",":","meth",":","`","forward","`","function","should","describe","how","to","compute","the","prior","latent","distribution","on","a","given","input",".","Typically",",","this","will","involve","a","mean","and","kernel","function",".","The","result","must","be","a",":","obj",":","`","~gpytorch.distributions.MultivariateNormal","`",".","Calling","this","model","will","return","the","posterior","of","the","latent","Gaussian","process","when","conditioned","on","the","training","data",".","The","output","will","be","a",":","obj",":","`","~gpytorch.distributions.MultivariateNormal","`",".","Example",":",">",">",">","class","MyGP","(","gpytorch.models.ExactGP",")",":",">",">",">","def","__init__","(","self",",","train_x",",","train_y",",","likelihood",")",":",">",">",">","super","(",")",".__init__","(","train_x",",","train_y",",","likelihood",")",">",">",">","self.mean_module","=","gpytorch.means.ZeroMean","(",")",">",">",">","self.covar_module","=","gpytorch.kernels.ScaleKernel","(","gpytorch.kernels.RBFKernel","(",")",")",">",">",">",">",">",">","def","forward","(","self",",","x",")",":",">",">",">","mean","=","self.mean_module","(","x",")",">",">",">","covar","=","self.covar_module","(","x",")",">",">",">","return","gpytorch.distributions.MultivariateNormal","(","mean",",","covar",")",">",">",">",">",">",">","#","train_x","=","...",";","train_y","=","...",">",">",">","likelihood","=","gpytorch.likelihoods.GaussianLikelihood","(",")",">",">",">","model","=","MyGP","(","train_x",",","train_y",",","likelihood",")",">",">",">",">",">",">","#","test_x","=","...",";",">",">",">","model","(","test_x",")","#","Returns","the","GP","latent","function","at","test_x",">",">",">","likelihood","(","model","(","test_x",")",")","#","Returns","the","(","approximate",")","predictive","posterior","distribution","at","test_x"]
docstr: Set training data (does not re-fit model hyper-parameters).
  
  :param torch.Tensor inputs: The new training inputs.
  :param torch.Tensor targets: The new training targets.
  :param bool strict: (default True) If `True`, the new inputs and
      targets must have the same shape, dtype, and device
      as the current inputs and targets. Otherwise, any shape/dtype/device are allowed.
docstr_tok: ["Set","training","data","(","does","not","re-fit","model","hyper-parameters",")",".",":","param","torch.Tensor","inputs",":","The","new","training","inputs",".",":","param","torch.Tensor","targets",":","The","new","training","targets",".",":","param","bool","strict",":","(","default","True",")","If","`","True","`",",","the","new","inputs","and","targets","must","have","the","same","shape",",","dtype",",","and","device","as","the","current","inputs","and","targets",".","Otherwise",",","any","shape\/dtype\/device","are","allowed","."]
code: def set_train_data(self, inputs=None, targets=None, strict=True):
      """
      Set training data (does not re-fit model hyper-parameters).
  
      :param torch.Tensor inputs: The new training inputs.
      :param torch.Tensor targets: The new training targets.
      :param bool strict: (default True) If `True`, the new inputs and
          targets must have the same shape, dtype, and device
          as the current inputs and targets. Otherwise, any shape/dtype/device are allowed.
      """
      if inputs is not None:
          if torch.is_tensor(inputs):
              inputs = (inputs,)
          inputs = tuple(
              input_.unsqueeze(-1)
              if input_.ndimension() == 1
              else input_
              for input_ in inputs
          )
          if strict:
              for input_, t_input in length_safe_zip(
                  inputs, self.train_inputs or (None,)
              ):
                  for attr in {"shape", "dtype", "device"}:
                      expected_attr = getattr(t_input, attr, None)
                      found_attr = getattr(input_, attr, None)
                      if expected_attr != found_attr:
                          msg = "Cannot modify {attr} of inputs (expected {e_attr}, found {f_attr})."
                          msg = msg.format(
                              attr=attr,
                              e_attr=expected_attr,
                              f_attr=found_attr,
                          )
                          raise RuntimeError(msg)
          self.train_inputs = inputs
      if targets is not None:
          if strict:
              for attr in {"shape", "dtype", "device"}:
                  expected_attr = getattr(
                      self.train_targets, attr, None
                  )
                  found_attr = getattr(targets, attr, None)
                  if expected_attr != found_attr:
                      msg = "Cannot modify {attr} of targets (expected {e_attr}, found {f_attr})."
                      msg = msg.format(
                          attr=attr,
                          e_attr=expected_attr,
                          f_attr=found_attr,
                      )
                      raise RuntimeError(msg)
          self.train_targets = targets
      self.prediction_strategy = None
  
imports: import warnings
  from copy import deepcopy
  import torch
  from ..None import settings
  from ..distributions import MultitaskMultivariateNormal, MultivariateNormal
  from ..likelihoods import _GaussianLikelihoodBase
  from ..utils.generic import length_safe_zip
  from ..utils.warnings import GPInputWarning
  from .exact_prediction_strategies import prediction_strategy
  from .gp import GP
label_desc: Use image node_id 7 for calling the ExactGP obj's underlying member method code with example usage: obj.set_train_data(inputs, targets, strict) without return types