code: def test_multinomial_large():
      p = tensor.fmatrix()
      u = tensor.fvector()
      m = multinomial.MultinomialFromUniform("auto")(p, u)
      f = function([p, u], m * 2, allow_input_downcast=True)
  
      pval = (
          np.arange(10000 * 4, dtype="float32").reshape((10000, 4))
          + 0.1
      )
      pval = pval / pval.sum(axis=1)[:, None]
      uval = np.ones_like(pval[:, 0]) * 0.5
      mval = f(pval, uval)
  
      assert mval.shape == pval.shape
      if config.cast_policy == "custom":
          assert mval.dtype == pval.dtype
      elif config.cast_policy == "numpy+floatX":
          assert mval.dtype == config.floatX
      elif config.cast_policy == "numpy":
          assert mval.dtype == "float64"
      else:
          raise NotImplementedError(config.cast_policy)
      utt.assert_allclose(mval.sum(axis=1), 2)
      asdf = np.asarray([0, 0, 2, 0]) + 0 * pval
      utt.assert_allclose(mval, asdf)
  
file_path: Theano/theano/sandbox/tests/test_multinomial.py
imports: from __future__ import absolute_import, print_function, division
  import os
  import sys
  from six import reraise
  from nose.plugins.skip import SkipTest
  import numpy
  import theano
  from theano import config, function, tensor
  from theano.sandbox import multinomial
  import theano.tests.unittest_tools
  from theano.compat import PY3
  from theano.misc.pkl_utils import CompatUnpickler
label_desc: Use image node_id 5 for calling a global function with example usage: test_multinomial_large() without return types