code: def test_mixture_logprob(
      distribution: Distribution,
      values_outside_support: Tensor,
      distribution_output: DistributionOutput,
  ) -> None:
      assert np.all(
          ~np.isnan(
              distribution.log_prob(values_outside_support).asnumpy()
          )
      ), f"{distribution} should return -inf log_probs instead of NaNs"
  
      p = 0.5
      gaussian = Gaussian(mu=mx.nd.array([0]), sigma=mx.nd.array([2.0]))
      mixture = MixtureDistribution(
          mixture_probs=mx.nd.array([[p, 1 - p]]),
          components=[gaussian, distribution],
      )
      lp = mixture.log_prob(values_outside_support)
      assert np.allclose(
          lp.asnumpy(),
          np.log(p)
          + gaussian.log_prob(values_outside_support).asnumpy(),
          atol=1e-6,
      ), "log_prob(x) should be equal to log(p)+gaussian.log_prob(x)"
  
      fit_mixture = fit_mixture_distribution(
          values_outside_support,
          MixtureDistributionOutput(
              [GaussianOutput(), distribution_output]
          ),
          variate_dimensionality=1,
          epochs=3,
      )
      for ci, c in enumerate(fit_mixture.components):
          for ai, a in enumerate(c.args):
              assert ~np.isnan(a.asnumpy()), f"NaN gradients led to {c}"
  
file_path: gluonts/test/mx/distribution/test_mixture.py
imports: import mxnet
  import numpy
  import pytest
  from gluonts.core.serde import dump_json, load_json
  from gluonts.gluonts_tqdm import tqdm
  from gluonts.mx import Tensor
  from gluonts.mx.distribution import Gamma, GammaOutput, Gaussian, GaussianOutput, GenPareto, GenParetoOutput, LaplaceOutput, MixtureDistribution, MixtureDistributionOutput, MultivariateGaussianOutput, StudentT, StudentTOutput
  from gluonts.mx.distribution.distribution import Distribution
  from gluonts.mx.distribution.distribution_output import DistributionOutput
  from gluonts.testutil import empirical_cdf
label_desc: Use image node_id 9 for calling a global function with example usage: test_mixture_logprob(distribution, values_outside_support, distribution_output) without return types