class_docstr: A mixture distribution where each component is a Distribution.
  
  Parameters
  ----------
  mixture_probs
      A tensor of mixing probabilities. The entries should all be positive
      and sum to 1 across the last dimension. Shape: (..., k), where k is
      the number of distributions to be mixed. All axes except the last one
      should either coincide with the ones from the component distributions,
      or be 1 (in which case, the mixing coefficient is shared across
      the axis).
  components
      A list of k Distribution objects representing the mixture components.
      Distributions can be of different types. Each component's support
      should be made of tensors of shape (..., d).
  F
      A module that can either refer to the Symbol API or the NDArray
      API in MXNet
class_docstr_tok: ["A","mixture","distribution","where","each","component","is","a","Distribution",".","Parameters","--","--","--","--","--","mixture_probs","A","tensor","of","mixing","probabilities",".","The","entries","should","all","be","positive","and","sum","to","1","across","the","last","dimension",".","Shape",":","(","...",",","k",")",",","where","k","is","the","number","of","distributions","to","be","mixed",".","All","axes","except","the","last","one","should","either","coincide","with","the","ones","from","the","component","distributions",",","or","be","1","(","in","which","case",",","the","mixing","coefficient","is","shared","across","the","axis",")",".","components","A","list","of","k","Distribution","objects","representing","the","mixture","components",".","Distributions","can","be","of","different","types",".","Each","component","'s","support","should","be","made","of","tensors","of","shape","(","...",",","d",")",".","F","A","module","that","can","either","refer","to","the","Symbol","API","or","the","NDArray","API","in","MXNet"]
code: def __init__(
      self,
      mixture_probs: Tensor,
      components: List[Distribution],
      F=None,
  ) -> None:
      # TODO: handle case with all components of the same type more
      # efficiently when sampling self.all_same = len(set
      # (c.__class__.__name__ for c in components)) == 1
      self.mixture_probs = mixture_probs
      self.components = components
      if not isinstance(mixture_probs, mx.sym.Symbol):
          # assert that all components have the same batch shape
          assert np.all(
              [
                  d.batch_shape == self.batch_shape
                  for d in components[1:]
              ]
          ), "All component distributions must have the same batch_shape."
  
          # assert that mixture_probs has the right shape
          assertion_message = f""" mixture_probs have shape
              {mixture_probs.shape}, but expected shape: (..., k), where k is
              len(components)={len(components)}. All axes except the last one
              should either coincide with the ones from the component
              distributions, or be 1 (in which case, the mixing coefficient is
              shared across the axis)."""
  
          expected_shape = self.batch_shape + (len(components),)
          assert len(expected_shape) == len(self.mixture_probs.shape), (
              assertion_message
              + " Maybe you need to expand the shape of mixture_probs at the"
              " zeroth axis."
          )
          for expected_dim, given_dim in zip(
              expected_shape, self.mixture_probs.shape
          ):
              assert (
                  expected_dim == given_dim
              ) or given_dim == 1, assertion_message
  
imports: from typing import List, Optional, Tuple
  import mxnet
  import numpy
  from mxnet import gluon
  from gluonts.core.component import validated
  from gluonts.mx import Tensor
  from .distribution import MAX_SUPPORT_VAL, Distribution, _expand_param, _index_tensor, getF
  from .distribution_output import DistributionOutput
label_desc: Use image node_id 1 to create a new MixtureDistribution object from inherited base classes: Distribution with example: obj = MixtureDistribution(mixture_probs, components, F)