code: def test_gluon_fisher_snedecor():
      class TestFisherSnedecor(HybridBlock):
          def __init__(self, func):
              super(TestFisherSnedecor, self).__init__()
              self._func = func
  
          def forward(self, df1, df2, *args):
              beta_dist = mgp.FisherSnedecor(
                  df1, df2, validate_args=True
              )
              return _distribution_method_invoker(
                  beta_dist, self._func, *args
              )
  
      shapes = [(), (1,), (2, 3), 6]
  
      # Test log_prob
      for shape, hybridize in itertools.product(shapes, [True, False]):
          df1 = np.random.uniform(0.5, 1.5, shape)
          df2 = np.random.uniform(0.5, 1.5, shape)
          samples = np.random.uniform(size=shape)
          net = TestFisherSnedecor("log_prob")
          if hybridize:
              net.hybridize()
          mx_out = net(df1, df2, samples).asnumpy()
          np_out = ss.f(dfn=df1.asnumpy(), dfd=df2.asnumpy()).logpdf(
              samples.asnumpy()
          )
          assert_almost_equal(
              mx_out, np_out, atol=1e-4, rtol=1e-3, use_broadcast=False
          )
  
      # Test `mean` and `var`
      for shape, hybridize in itertools.product(shapes, [True, False]):
          for func in ["mean", "variance"]:
              df1 = np.random.uniform(0.5, 1.5, shape)
              df2 = np.random.uniform(4.0, 6.0, shape)
              net = TestFisherSnedecor(func)
              if hybridize:
                  net.hybridize()
              mx_out = net(df1, df2).asnumpy()
              ss_f = ss.f(dfn=df1.asnumpy(), dfd=df2.asnumpy())
              if func == "mean":
                  np_out = ss_f.mean()
              else:
                  np_out = ss_f.var()
              assert_almost_equal(
                  mx_out,
                  np_out,
                  atol=1e-4,
                  rtol=1e-3,
                  use_broadcast=False,
              )
  
imports: import mxnet
  import numpy
  from mxnet import np, npx, autograd
  from mxnet import gluon
  import mxnet.gluon.probability
  from mxnet.gluon.probability import StochasticBlock, StochasticSequential
  from mxnet.gluon import HybridBlock
  from mxnet.test_utils import use_np, assert_almost_equal
  from numpy.testing import assert_array_equal
  import pytest
  import scipy.stats
  import scipy.special
  import itertools
  from numbers import Number
label_desc: Use image node_id 17 for calling a global function with example usage: test_gluon_fisher_snedecor() and returns: _distribution_method_invoker