code: def _construct_inner_samplers(
      batch_sizes: List[int],
      valfunc_cls: List[Optional[Type[AcquisitionFunction]]],
      inner_mc_samples: List[Optional[int]],
      objective: Optional[MCAcquisitionObjective] = None,
  ) -> List[Optional[MCSampler]]:
      r"""Check validity of inputs and construct inner samplers.
  
      Helper function to be used internally for constructing inner samplers.
  
      Args:
          batch_sizes: A list `[q_1, ..., q_k]` containing the batch sizes for the
              `k` look-ahead steps.
          valfunc_cls: A list of `k + 1` acquisition function classes to be used as the
              (stage + terminal) value functions. Each element (except for the last one)
              can be `None`, in which case a zero stage value is assumed for the
              respective stage.
          inner_mc_samples: A list `[n_0, ..., n_k]` containing the number of MC
              samples to be used for evaluating the stage value function. Ignored if
              the objective is `None`.
          objective: The objective under which the output is evaluated. If `None`, use
              the model output (requires a single-output model or a posterior transform).
              Otherwise the objective is MC-evaluated (using `inner_sampler`).
  
      Returns:
          A list with `k + 1` elements that are either `MCSampler`s or `None.
      """
      inner_samplers = []
      for q, vfc, mcs in zip(
          [None] + batch_sizes, valfunc_cls, inner_mc_samples
      ):
          if vfc is None:
              inner_samplers.append(None)
          elif vfc == qMultiStepLookahead:
              raise UnsupportedError(
                  "qMultiStepLookahead not supported as a value function "
                  "(I see what you did there, nice try...)."
              )
          elif issubclass(vfc, AnalyticAcquisitionFunction):
              if objective is not None:
                  raise UnsupportedError(
                      "Only PosteriorTransforms are supported for analytic value "
                      f"functions. Received a {objective.__class__.__name__}."
                  )
              # At this point, we don't know the initial q-batch size here
              if q is not None and q > 1:
                  raise UnsupportedError(
                      "Only batch sizes of q=1 are supported for analytic value "
                      "functions."
                  )
              if q is not None and mcs is not None:
                  warnings.warn(
                      "inner_mc_samples is ignored for analytic acquisition functions",
                      BotorchWarning,
                  )
              inner_samplers.append(None)
          else:
              inner_sampler = SobolQMCNormalSampler(
                  sample_shape=torch.Size([32 if mcs is None else mcs])
              )
              inner_samplers.append(inner_sampler)
      return inner_samplers
  
imports: from __future__ import annotations
  import math
  import warnings
  from typing import Any, Callable, Dict, List, Optional, Tuple, Type
  import numpy
  import torch
  from botorch.acquisition import AcquisitionFunction, OneShotAcquisitionFunction
  from botorch.acquisition.analytic import AnalyticAcquisitionFunction, PosteriorMean
  from botorch.acquisition.monte_carlo import MCAcquisitionFunction
  from botorch.acquisition.objective import MCAcquisitionObjective, PosteriorTransform
  from botorch.exceptions.errors import UnsupportedError
  from botorch.exceptions.warnings import BotorchWarning
  from botorch.models.model import Model
  from botorch.optim.initializers import initialize_q_batch
  from botorch.sampling.base import MCSampler
  from botorch.sampling.normal import SobolQMCNormalSampler
  from botorch.utils.transforms import match_batch_shape, t_batch_mode_transform, unnormalize
  from torch import Size, Tensor
  from torch.distributions import Beta
  from torch.nn import ModuleList
label_desc: Use image node_id 4 for calling a global function with example usage: _construct_inner_samplers(batch_sizes, valfunc_cls, inner_mc_samples, objective) and returns: inner_samplers