class_docstr: Sample from a set of points according to their max posterior value.
  
  Example:
      >>> MPS = MaxPosteriorSampling(model)  # model w/ feature dim d=3
      >>> X = torch.rand(2, 100, 3)
      >>> sampled_X = MPS(X, num_samples=5)
docstr: Sample from the model posterior.
  
  Args:
      X: A `batch_shape x N x d`-dim Tensor from which to sample (in the `N`
          dimension) according to the maximum posterior value under the objective.
      num_samples: The number of samples to draw.
      observation_noise: If True, sample with observation noise.
  
  Returns:
      A `batch_shape x num_samples x d`-dim Tensor of samples from `X`, where
      `X[..., i, :]` is the `i`-th sample.
docstr_tok: ["Sample","from","the","model","posterior",".","Args",":","X",":","A","`","batch_shape","x","N","x","d","`","-dim","Tensor","from","which","to","sample","(","in","the","`","N","`","dimension",")","according","to","the","maximum","posterior","value","under","the","objective",".","num_samples",":","The","number","of","samples","to","draw",".","observation_noise",":","If","True",",","sample","with","observation","noise",".","Returns",":","A","`","batch_shape","x","num_samples","x","d","`","-dim","Tensor","of","samples","from","`","X","`",",","where","`","X","[","...",",","i",",",":","]","`","is","the","`","i","`","-th","sample","."]
code: def forward(
      self,
      X: Tensor,
      num_samples: int = 1,
      observation_noise: bool = False,
  ) -> Tensor:
      r"""Sample from the model posterior.
  
      Args:
          X: A `batch_shape x N x d`-dim Tensor from which to sample (in the `N`
              dimension) according to the maximum posterior value under the objective.
          num_samples: The number of samples to draw.
          observation_noise: If True, sample with observation noise.
  
      Returns:
          A `batch_shape x num_samples x d`-dim Tensor of samples from `X`, where
          `X[..., i, :]` is the `i`-th sample.
      """
      posterior = self.model.posterior(
          X,
          observation_noise=observation_noise,
          posterior_transform=self.posterior_transform,
      )
      # num_samples x batch_shape x N x m
      samples = posterior.rsample(
          sample_shape=torch.Size([num_samples])
      )
      return self.maximize_samples(X, samples, num_samples)
  
imports: from __future__ import annotations
  from abc import ABC, abstractmethod
  from typing import Any, Optional, Union
  import torch
  from botorch.acquisition.acquisition import AcquisitionFunction
  from botorch.acquisition.objective import IdentityMCObjective, MCAcquisitionObjective, PosteriorTransform
  from botorch.generation.utils import _flip_sub_unique
  from botorch.models.model import Model
  from botorch.models.model_list_gp_regression import ModelListGP
  from botorch.models.multitask import MultiTaskGP
  from botorch.utils.sampling import batched_multinomial
  from botorch.utils.transforms import standardize
  from torch import Tensor
  from torch.nn import Module
label_desc: Use image node_id 2 for calling the MaxPosteriorSampling obj's underlying member method code with example usage: obj.forward(X, num_samples, observation_noise) and returns: self