code: def test_multinomial_large():
      # DEBUG_MODE will test this on GPU
      p = tensor.fmatrix()
      u = tensor.fvector()
      m = theano.sandbox.multinomial.MultinomialFromUniform("auto")(
          p, u
      )
      f = function(
          [p, u], m * 2, allow_input_downcast=True, mode=mode_with_gpu
      )
      assert any(
          [
              type(node.op) is GPUAMultinomialFromUniform
              for node in f.maker.fgraph.toposort()
          ]
      )
  
      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)
  
imports: from __future__ import absolute_import, print_function, division
  import os
  import numpy
  import unittest
  import theano
  from theano import config, function, tensor
  from theano.compat import PY3
  from theano.misc.pkl_utils import CompatUnpickler
  from theano.sandbox import multinomial
  from theano.sandbox.rng_mrg import MRG_RandomStreams
  import theano.tests.unittest_tools
  from .config import mode_with_gpu
  from ..multinomial import GPUAMultinomialFromUniform, GPUAChoiceFromUniform
label_desc: Use image node_id 3 for calling a global function with example usage: test_multinomial_large() without return types