def testInternalBias(self):
     batch_size = 4
     num_hidden = 6
     num_dims = 8
     test_inputs = tf.random_normal(shape=(batch_size, num_dims))
     nade = Nade(num_dims, num_hidden, internal_bias=True)
     log_prob, cond_probs = nade.log_prob(test_inputs)
     sample, sample_prob = nade.sample(n=batch_size)
     with self.test_session() as sess:
         sess.run([tf.global_variables_initializer()])
         self.assertEqual(log_prob.eval().shape, (batch_size, ))
         self.assertEqual(cond_probs.eval().shape, (batch_size, num_dims))
         self.assertEqual(sample.eval().shape, (batch_size, num_dims))
         self.assertEqual(sample_prob.eval().shape, (batch_size, ))
Example #2
0
 def testInternalBias(self):
   batch_size = 4
   num_hidden = 6
   num_dims = 8
   test_inputs = tf.random_normal(shape=(batch_size, num_dims))
   nade = Nade(num_dims, num_hidden, internal_bias=True)
   log_prob, cond_probs = nade.log_prob(test_inputs)
   sample, sample_prob = nade.sample(n=batch_size)
   with self.test_session() as sess:
     sess.run([tf.global_variables_initializer()])
     self.assertEqual(log_prob.eval().shape, (batch_size,))
     self.assertEqual(cond_probs.eval().shape, (batch_size, num_dims))
     self.assertEqual(sample.eval().shape, (batch_size, num_dims))
     self.assertEqual(sample_prob.eval().shape, (batch_size,))