class_docstr: Mixin to add a `fantasize` method to a `Model`.
  
  Example:
      class BaseModel:
          def __init__(self, ...):
          def condition_on_observations(self, ...):
          def posterior(self, ...):
          def transform_inputs(self, ...):
  
      class ModelThatCanFantasize(BaseModel, FantasizeMixin):
          def __init__(self, args):
              super().__init__(args)
  
      model = ModelThatCanFantasize(...)
      model.fantasize(X)
class_docstr_tok: ["Mixin","to","add","a","`","fantasize","`","method","to","a","`","Model","`",".","Example",":","class","BaseModel",":","def","__init__","(","self",",","...",")",":","def","condition_on_observations","(","self",",","...",")",":","def","posterior","(","self",",","...",")",":","def","transform_inputs","(","self",",","...",")",":","class","ModelThatCanFantasize","(","BaseModel",",","FantasizeMixin",")",":","def","__init__","(","self",",","args",")",":","super","(",")",".__init__","(","args",")","model","=","ModelThatCanFantasize","(","...",")","model.fantasize","(","X",")"]
docstr: Classes that inherit from `FantasizeMixin` must implement
  a `posterior` method.
code: def posterior(
      self,
      X: Tensor,
      *args,
      observation_noise: bool = False,
      **kwargs: Any,
  ) -> Posterior:
      """
      Classes that inherit from `FantasizeMixin` must implement
      a `posterior` method.
      """
  
imports: from __future__ import annotations
  import warnings
  from abc import ABC, abstractmethod
  from collections import defaultdict
  from copy import deepcopy
  from typing import Any, Callable, Dict, List, Mapping, Optional, Set, TYPE_CHECKING, TypeVar, Union
  import numpy
  import torch
  from botorch import settings
  from botorch.exceptions.errors import BotorchTensorDimensionError, DeprecationError, InputDataError
  from botorch.logging import shape_to_str
  from botorch.models.utils.assorted import fantasize
  from botorch.posteriors import Posterior, PosteriorList
  from botorch.sampling.base import MCSampler
  from botorch.sampling.list_sampler import ListSampler
  from botorch.utils.datasets import SupervisedDataset
  from botorch.utils.transforms import is_fully_bayesian
  from gpytorch.likelihoods.gaussian_likelihood import FixedNoiseGaussianLikelihood
  from torch import Tensor
  from torch.nn import Module, ModuleDict, ModuleList
label_desc: Use image node_id 2 for calling the FantasizeMixin obj's underlying member method code with example usage: obj.posterior(X) without return types