def test_n_samples_compatibility():
 folder = os.path.dirname(os.path.abspath(__file__))
 with open(os.path.join(folder, 'multinomial_test_graph.pkl'), 'rb') as pkl_file:
  if PY3:
   u = CompatUnpickler(pkl_file, encoding='latin1')
  else:
   u = CompatUnpickler(pkl_file)
  try:
   (X, samples) = u.load()
  except ImportError:
   if (sys.platform == 'win32'):
    (exc_type, exc_value, exc_trace) = sys.exc_info()
    reraise(SkipTest, exc_value, exc_trace)
   raise
  f = theano.function([X], samples)
  res = f(numpy.random.randn(20, 10))
  assert numpy.all((res.sum(axis=1) == 1))

def test_n_samples_compatibility ( ) : folder = os . path . dirname ( os . path . abspath ( __file__ ) ) with open ( os . path . join ( folder , 'multinomial_test_graph.pkl' ) , 'rb' ) as pkl_file : if PY3 : u = CompatUnpickler ( pkl_file , encoding = 'latin1' ) else : u = CompatUnpickler ( pkl_file ) try : ( X , samples ) = u . load ( ) except ImportError : if ( sys . platform == 'win32' ) : ( exc_type , exc_value , exc_trace ) = sys . exc_info ( ) reraise ( SkipTest , exc_value , exc_trace ) raise f = theano . function ( [ X ] , samples ) res = f ( numpy . random . randn ( 20 , 10 ) ) assert numpy . all ( ( res . sum ( axis = 1 ) == 1 ) )
this test checks if the new change to multinomialfromuniform is still compatible with old interface .