code: def test_np_gamma():
      types = [None, "float32", "float64"]
      device = mx.device.current_device()
      samples = 1000000
      # Generation test
      trials = 8
      num_buckets = 5
      for _ in types:
          for alpha, beta in [(2.0, 3.0), (0.5, 1.0)]:
              buckets, probs = gen_buckets_probs_with_ppf(
                  lambda x: ss.gamma.ppf(x, a=alpha, loc=0, scale=beta),
                  num_buckets,
              )
              buckets = np.array(buckets).tolist()
  
              def generator_mx(x):
                  return np.random.gamma(
                      alpha, beta, size=samples, device=device
                  ).asnumpy()
  
              verify_generator(
                  generator=generator_mx,
                  buckets=buckets,
                  probs=probs,
                  nsamples=samples,
                  nrepeat=trials,
              )
              generator_mx_same_seed = lambda x: _np.concatenate(
                  [
                      np.random.gamma(
                          alpha, beta, size=(x // 10), device=device
                      ).asnumpy()
                      for _ in range(10)
                  ]
              )
              verify_generator(
                  generator=generator_mx_same_seed,
                  buckets=buckets,
                  probs=probs,
                  nsamples=samples,
                  nrepeat=trials,
              )
  
imports: import itertools
  import os
  import sys
  from os import path
  import unittest
  import numpy
  import mxnet
  from mxnet import np, npx, autograd
  from mxnet.gluon import HybridBlock
  from mxnet.test_utils import same, assert_almost_equal, rand_shape_nd, rand_ndarray, use_np
  from common import retry
  from mxnet.test_utils import verify_generator, gen_buckets_probs_with_ppf, assert_exception, is_op_runnable, collapse_sum_like
  from mxnet.ndarray.ndarray import py_slice
  from mxnet.base import integer_types
  import scipy.stats
label_desc: Use image node_id 6 for calling a global function with example usage: test_np_gamma() and returns: np