class_docstr: Abstract base class for Samplers.
  
  Subclasses must implement the `forward` method.
  
  Example:
      This method is usually not called directly, but via the sampler's
      `__call__` method:
      >>> posterior = model.posterior(test_X)
      >>> samples = sampler(posterior)
  
  :meta private:
class_docstr_tok: ["Abstract","base","class","for","Samplers",".","Subclasses","must","implement","the","`","forward","`","method",".","Example",":","This","method","is","usually","not","called","directly",",","but","via","the","sampler's","`","__call__","`","method",":",">",">",">","posterior","=","model.posterior","(","test_X",")",">",">",">","samples","=","sampler","(","posterior",")",":","meta","private",":"]
docstr: Get the t-batch range of the posterior with an optional override.
  
  In rare cases, e.g., in `qMultiStepLookahead`, we may want to override the
  `batch_range` of the posterior. If this behavior is desired, one can set
  `batch_range_override` attribute on the samplers.
  
  Args:
      posterior: The posterior to sample from.
  
  Returns:
      The t-batch range to use for collapsing the base samples.
docstr_tok: ["Get","the","t-batch","range","of","the","posterior","with","an","optional","override",".","In","rare","cases",",","e.g.",",","in","`","qMultiStepLookahead","`",",","we","may","want","to","override","the","`","batch_range","`","of","the","posterior",".","If","this","behavior","is","desired",",","one","can","set","`","batch_range_override","`","attribute","on","the","samplers",".","Args",":","posterior",":","The","posterior","to","sample","from",".","Returns",":","The","t-batch","range","to","use","for","collapsing","the","base","samples","."]
code: def _get_batch_range(self, posterior: Posterior) -> Tuple[int, int]:
      r"""Get the t-batch range of the posterior with an optional override.
  
      In rare cases, e.g., in `qMultiStepLookahead`, we may want to override the
      `batch_range` of the posterior. If this behavior is desired, one can set
      `batch_range_override` attribute on the samplers.
  
      Args:
          posterior: The posterior to sample from.
  
      Returns:
          The t-batch range to use for collapsing the base samples.
      """
      if hasattr(self, "batch_range_override"):
          return self.batch_range_override
      return posterior.batch_range
  
file_path: botorch/botorch/sampling/base.py
imports: from __future__ import annotations
  import warnings
  from abc import ABC, abstractmethod
  from typing import Any, Optional, Tuple
  import torch
  from botorch.exceptions.errors import InputDataError
  from botorch.posteriors import Posterior
  from torch import Tensor
  from torch.nn import Module
label_desc: Use image node_id 3 for calling the MCSampler obj's underlying member method code with example usage: obj._get_batch_range(posterior) and returns: posterior, self