code: def basic_multinomialtest(
      f,
      steps,
      sample_size,
      target_pvals,
      n_samples,
      prefix="",
      mean_rtol=0.04,
  ):
      dt = 0.0
      avg_pvals = np.zeros(target_pvals.shape, dtype=config.floatX)
  
      for i in xrange(steps):
          t0 = time.time()
          ival = f()
          assert ival.shape == sample_size
          assert np.all(np.sum(ival, axis=1) == n_samples)
          dt += time.time() - t0
          avg_pvals += ival
      avg_pvals /= steps * n_samples
  
      assert np.mean(abs(avg_pvals - target_pvals)) < mean_rtol
  
      print("random?[:10]\n", np.asarray(f()[:10]))
      print(prefix, "mean", avg_pvals)
      # < mean_rtol, 'bad mean? %s %s' % (str(avg_pvals), str(target_pvals))
      print(np.mean(abs(avg_pvals - target_pvals)))
      print(prefix, "time", dt)
      print(prefix, "elements", steps * np.prod(target_pvals.shape))
      print(
          prefix,
          "samples/sec",
          steps * np.prod(target_pvals.shape) / dt,
      )
  
imports: from __future__ import absolute_import, print_function, division
  import os
  import sys
  import time
  import unittest
  from nose.tools import assert_raises
  import numpy
  from six.moves import xrange
  import theano
  from theano import change_flags, config, tensor
  from theano.sandbox import rng_mrg
  from theano.sandbox.rng_mrg import MRG_RandomStreams
  from theano.tests import unittest_tools
  from theano.tests.unittest_tools import attr
label_desc: Use image node_id 14 for calling a global function with example usage: basic_multinomialtest(f, steps, sample_size, target_pvals, n_samples, prefix, mean_rtol) without return types