示例#1
0
 def testScalarCongruency(self):
     bijector_test_util.assert_scalar_congruency(tfb.ShiftedGompertzCDF(
         concentration=0.1, rate=0.4),
                                                 lower_x=1.,
                                                 upper_x=10.,
                                                 eval_func=self.evaluate,
                                                 rtol=0.05)
示例#2
0
 def testVariableRate(self):
     x = tf.Variable(1.)
     b = tfb.ShiftedGompertzCDF(concentration=1.,
                                rate=x,
                                validate_args=True)
     self.evaluate(x.initializer)
     self.assertIs(x, b.rate)
     self.assertEqual((), self.evaluate(b.forward(1.)).shape)
     with self.assertRaisesOpError("Argument `rate` must be positive."):
         with tf.control_dependencies([x.assign(-1.)]):
             self.evaluate(b.forward(1.))
示例#3
0
 def testBijectiveAndFinite(self):
     bijector = tfb.ShiftedGompertzCDF(concentration=0.2,
                                       rate=0.01,
                                       validate_args=True)
     x = np.logspace(-10, 2, num=10).astype(np.float32)
     y = np.linspace(0.01, 0.99, num=10).astype(np.float32)
     bijector_test_util.assert_bijective_and_finite(bijector,
                                                    x,
                                                    y,
                                                    eval_func=self.evaluate,
                                                    event_ndims=0,
                                                    rtol=1e-3)