class_docstr: A Posterior represented by a list of independent Posteriors.
  
  When at least one of the posteriors is a `GaussianMixturePosterior`, the other
  posteriors are expanded to match the size of the `GaussianMixturePosterior`.
class_docstr_tok: ["A","Posterior","represented","by","a","list","of","independent","Posteriors",".","When","at","least","one","of","the","posteriors","is","a","`","GaussianMixturePosterior","`",",","the","other","posteriors","are","expanded","to","match","the","size","of","the","`","GaussianMixturePosterior","`","."]
docstr: Returns the shape of the samples produced by the posterior with
  the given `sample_shape`.
  
  If there's at least one `GaussianMixturePosterior`, the MCMC dimension
  is included the `_extended_shape`.
docstr_tok: ["Returns","the","shape","of","the","samples","produced","by","the","posterior","with","the","given","`","sample_shape","`",".","If","there","'s","at","least","one","`","GaussianMixturePosterior","`",",","the","MCMC","dimension","is","included","the","`","_extended_shape","`","."]
code: def _extended_shape(
      self, sample_shape: torch.Size = torch.Size()  # noqa: B008
  ) -> torch.Size:
      r"""Returns the shape of the samples produced by the posterior with
      the given `sample_shape`.
  
      If there's at least one `GaussianMixturePosterior`, the MCMC dimension
      is included the `_extended_shape`.
      """
      if self._is_gaussian_mixture:
          mcmc_shape = torch.Size([self._get_mcmc_batch_dimension()])
          extend_dim = (
              MCMC_DIM + 1
          )  # The dimension to inject MCMC shape.
      extended_shapes = []
      for p in self.posteriors:
          es = p._extended_shape(sample_shape=sample_shape)
          if self._is_gaussian_mixture and not isinstance(
              p, GaussianMixturePosterior
          ):
              # Extend the shapes of non-fully Bayesian ones to match.
              extended_shapes.append(
                  es[:extend_dim] + mcmc_shape + es[extend_dim:]
              )
          else:
              extended_shapes.append(es)
      batch_shapes = [es[:-1] for es in extended_shapes]
      if len(set(batch_shapes)) > 1:
          raise NotImplementedError(
              "`PosteriorList` is only supported if the constituent posteriors "
              f"all have the same `batch_shape`. Batch shapes: {batch_shapes}."
          )
      # Last dimension is the output dimension (concatenation dimension).
      return batch_shapes[0] + torch.Size(
          [sum(es[-1] for es in extended_shapes)]
      )
  
imports: from __future__ import annotations
  from functools import cached_property
  from typing import Any, List, Optional
  import torch
  from botorch.posteriors.fully_bayesian import GaussianMixturePosterior, MCMC_DIM
  from botorch.posteriors.posterior import Posterior
  from torch import Tensor
label_desc: Use image node_id 8 for calling the PosteriorList obj's underlying member method code with example usage: obj._extended_shape(sample_shape) and returns: unknown