code: def test_slice_axis_results(distr, slice_item):
      s = distr.sample().asnumpy()
      sliced = distr[slice_item]
      s_sliced = sliced.sample().asnumpy()
      assert s_sliced.shape == s[slice_item].shape
  
      y = np.random.uniform(size=BATCH_SHAPE)
      lp_expected = distr.loss(mx.nd.array(y)).asnumpy()[slice_item]
      lp_actual = sliced.loss(mx.nd.array(y[slice_item])).asnumpy()
      assert np.allclose(lp_actual, lp_expected)
  
      tmp = (
          distr.base_distribution
          if isinstance(distr, TransformedDistribution)
          else distr
      )
      has_quantile_fn = isinstance(
          tmp, DISTRIBUTIONS_WITH_QUANTILE_FUNCTION
      )
  
      if has_quantile_fn:
          for ql in [0.01, 0.1, 0.5, 0.9, 0.99]:
              qs_actual = sliced.quantile(mx.nd.array([ql])).asnumpy()[
                  0
              ]
              qs_expected = distr.quantile(mx.nd.array([ql])).asnumpy()[
                  0
              ][slice_item]
              assert np.allclose(qs_actual, qs_expected)
  
file_path: gluonts/test/mx/distribution/test_distribution_slice.py
imports: import mxnet
  import numpy
  import pytest
  import gluonts.mx.distribution.bijection
  from gluonts.mx.distribution import Beta, Binned, Dirichlet, Gamma, Laplace, MixtureDistribution, NegativeBinomial, PiecewiseLinear, Poisson, StudentT, TransformedDistribution, Uniform
  from gluonts.mx.distribution.box_cox_transform import BoxCoxTransform
  from gluonts.mx.distribution.gaussian import Gaussian
label_desc: Use image node_id 2 for calling a global function with example usage: test_slice_axis_results(distr, slice_item) without return types