def testOneDimensionalArg(self): # Should evaluate to 1 and 1/2. x_one = [1, 1.] x_one_half = [2, 1.] with self.test_session(): self.assertAllClose(1, exp(math_ops.lbeta(x_one).eval())) self.assertAllClose(0.5, exp(math_ops.lbeta(x_one_half).eval()))
def testLengthOneLastDimensionResultsInOne(self): # If there is only one coefficient, the formula still works, and we get one # as the answer, alwyas. x_a = [5.5] x_b = [0.1] with self.test_session(): self.assertAllClose(1, exp(math_ops.lbeta(x_a).eval())) self.assertAllClose(1, exp(math_ops.lbeta(x_b).eval()))
def testTwoDimensionalArg(self): # Should evaluate to 1/2. x_one_half = [[2, 1.], [2, 1.]] with self.test_session(): self.assertAllClose([0.5, 0.5], exp(math_ops.lbeta(x_one_half).eval()))