code: def test_distribution_shapes(
      distr: Distribution,
      expected_batch_shape: Tuple,
      expected_event_shape: Tuple,
  ):
      assert distr.batch_shape == expected_batch_shape
      assert distr.event_shape == expected_event_shape
  
      x = distr.sample()
  
      assert x.shape == distr.batch_shape + distr.event_shape
  
      loss = distr.loss(x)
  
      assert loss.shape == distr.batch_shape
  
      x1 = distr.sample(num_samples=1)
  
      assert x1.shape == (1,) + distr.batch_shape + distr.event_shape
  
      x3 = distr.sample(num_samples=3)
  
      assert x3.shape == (3,) + distr.batch_shape + distr.event_shape
  
      def has_quantile(d):
          return isinstance(
              d, (Uniform, Gaussian, Laplace, EmpiricalDistribution)
          )
  
      if (
          has_quantile(distr)
          or isinstance(distr, TransformedDistribution)
          and has_quantile(distr.base_distribution)
      ):
          qs1 = distr.quantile(mx.nd.array([0.5]))
          assert (
              qs1.shape == (1,) + distr.batch_shape + distr.event_shape
          )
  
file_path: gluonts/test/mx/distribution/test_distribution_shapes.py
imports: from typing import Tuple
  import mxnet
  import pytest
  from gluonts.mx.model.tpp.distribution import Loglogistic, Weibull
  from gluonts.mx.distribution import Beta, Dirichlet, DirichletMultinomial, Distribution, EmpiricalDistribution, Gamma, Gaussian, Laplace, MixtureDistribution, MultivariateGaussian, NegativeBinomial, PiecewiseLinear, Poisson, StudentT, TransformedDistribution, Uniform
  from gluonts.mx.distribution.bijection import AffineTransformation
  from gluonts.mx.distribution.box_cox_transform import BoxCoxTransform
  from gluonts.mx.util import make_nd_diag
label_desc: Use image node_id 1 for calling a global function with example usage: test_distribution_shapes(distr, expected_batch_shape, expected_event_shape) and returns: isinstance