def _test(x, a, b, loc=0, scale=1):
    xtf = tf.constant(x)
    val_true = stats.truncnorm.logpdf(x, a, b, loc, scale)
    _assert_eq(truncnorm.logpdf(xtf, a, b, loc, scale), val_true)
    _assert_eq(truncnorm.logpdf(xtf, a, b, tf.constant(loc), tf.constant(scale)), val_true)
    _assert_eq(truncnorm.logpdf(xtf, a, b, tf.constant([loc]), tf.constant(scale)), val_true)
    _assert_eq(truncnorm.logpdf(xtf, a, b, tf.constant(loc), tf.constant([scale])), val_true)
    _assert_eq(truncnorm.logpdf(xtf, a, b, tf.constant([loc]), tf.constant([scale])), val_true)
Beispiel #2
0
 def _test(self, x, a, b, loc=0, scale=1):
     xtf = tf.constant(x)
     val_true = stats.truncnorm.logpdf(x, a, b, loc, scale)
     with self.test_session():
         self.assertAllClose(
             truncnorm.logpdf(xtf, a, b, loc, scale).eval(), val_true)
         self.assertAllClose(
             truncnorm.logpdf(xtf, a, b, tf.constant(loc),
                              tf.constant(scale)).eval(), val_true)
 def _test(self, x, a, b, loc=0, scale=1):
     val_true = stats.truncnorm.logpdf(x, a, b, loc, scale)
     with self.test_session():
         self.assertAllClose(
             truncnorm.logpdf(x, a=a, b=b, loc=loc, scale=scale).eval(),
             val_true)
 def _test(self, x, a, b, loc=0, scale=1):
   val_true = stats.truncnorm.logpdf(x, a, b, loc, scale)
   with self.test_session():
     self.assertAllClose(truncnorm.logpdf(
         x, a=a, b=b, loc=loc, scale=scale).eval(),
         val_true)
 def _test(self, x, a, b, loc=0, scale=1):
     xtf = tf.constant(x)
     val_true = stats.truncnorm.logpdf(x, a, b, loc, scale)
     with self.test_session():
         self.assertAllClose(truncnorm.logpdf(xtf, a, b, loc, scale).eval(), val_true)
         self.assertAllClose(truncnorm.logpdf(xtf, a, b, tf.constant(loc), tf.constant(scale)).eval(), val_true)