code: def test_multinomial_vector(self):
      rng_R = random_state_type()
      n = tensor.lvector()
      pvals = tensor.matrix()
      post_r, out = multinomial(rng_R, n=n, pvals=pvals)
      assert out.ndim == 2
      f = compile.function(
          [rng_R, n, pvals], [post_r, out], accept_inplace=True
      )
  
      n_val = [1, 2, 3]
      pvals_val = [[0.1, 0.9], [0.2, 0.8], [0.3, 0.7]]
      pvals_val = np.asarray(pvals_val, dtype=config.floatX)
      rng = np.random.RandomState(utt.fetch_seed())
      numpy_rng = np.random.RandomState(utt.fetch_seed())
  
      # Arguments of size (3,)
      rng0, val0 = f(rng, n_val, pvals_val)
      numpy_val0 = np.asarray(
          [
              numpy_rng.multinomial(n=nv, pvals=pv)
              for nv, pv in zip(n_val, pvals_val)
          ]
      )
      assert np.all(val0 == numpy_val0)
  
      # arguments of size (2,)
      rng1, val1 = f(rng0, n_val[:-1], pvals_val[:-1])
      numpy_val1 = np.asarray(
          [
              numpy_rng.multinomial(n=nv, pvals=pv)
              for nv, pv in zip(n_val[:-1], pvals_val[:-1])
          ]
      )
      assert np.all(val1 == numpy_val1)
  
      # Specifying the size explicitly
      g = compile.function(
          [rng_R, n, pvals],
          multinomial(rng_R, n=n, pvals=pvals, size=(3,)),
          accept_inplace=True,
      )
      rng2, val2 = g(rng1, n_val, pvals_val)
      numpy_val2 = np.asarray(
          [
              numpy_rng.multinomial(n=nv, pvals=pv)
              for nv, pv in zip(n_val, pvals_val)
          ]
      )
      assert np.all(val2 == numpy_val2)
      self.assertRaises(ValueError, g, rng2, n_val[:-1], pvals_val[:-1])
  
imports: from __future__ import absolute_import, print_function, division
  import numpy
  import pickle
  from theano.tests import unittest_tools
  from theano.tensor.raw_random import *
  from theano.tensor import raw_random, ivector, dvector, iscalar, dcol, dtensor3
  from theano import tensor
  from theano import compile, config, gof
label_desc: Use image node_id 30 for calling the T_random_function obj's underlying member method code with example usage: obj.test_multinomial_vector() without return types