示例#1
0
 def _test(self, x, n, p):
     xtf = tf.constant(x)
     val_true = stats.nbinom.logpmf(x, n, p)
     with self.test_session():
         self.assertAllClose(nbinom.logpmf(xtf, n, p).eval(), val_true)
         self.assertAllClose(
             nbinom.logpmf(xtf, tf.constant(n), tf.constant(p)).eval(),
             val_true)
def _test(x, n, p):
    xtf = tf.constant(x)
    val_true = stats.nbinom.logpmf(x, n, p)
    _assert_eq(nbinom.logpmf(xtf, n, p), val_true)
    _assert_eq(nbinom.logpmf(xtf, tf.constant(n), tf.constant(p)), val_true)
    _assert_eq(nbinom.logpmf(xtf, tf.constant(n), tf.constant([p])), val_true)
    _assert_eq(nbinom.logpmf(xtf, tf.constant([n]), tf.constant(p)), val_true)
    _assert_eq(nbinom.logpmf(xtf, tf.constant([n]), tf.constant([p])), val_true)
示例#3
0
def _test_logpmf(x, n, p):
    xtf = tf.constant(x)
    val_true = stats.nbinom.logpmf(x, n, p)
    _assert_eq(nbinom.logpmf(xtf, n, p), val_true)
    _assert_eq(nbinom.logpmf(xtf, tf.constant(n), tf.constant(p)), val_true)
    _assert_eq(nbinom.logpmf(xtf, tf.constant(n), tf.constant([p])), val_true)
    _assert_eq(nbinom.logpmf(xtf, tf.constant([n]), tf.constant(p)), val_true)
    _assert_eq(nbinom.logpmf(xtf, tf.constant([n]), tf.constant([p])), val_true)
示例#4
0
 def _test(self, x, n, p):
     xtf = tf.constant(x)
     val_true = stats.nbinom.logpmf(x, n, p)
     with self.test_session():
         self.assertAllClose(nbinom.logpmf(xtf, n, p).eval(), val_true)
         self.assertAllClose(nbinom.logpmf(xtf, tf.constant(n), tf.constant(p)).eval(), val_true)
 def _test(self, x, n, p):
   val_true = stats.nbinom.logpmf(x, n, p)
   with self.test_session():
     self.assertAllClose(nbinom.logpmf(x, n=n, p=p).eval(), val_true)