def test_expint_boundary(self): self.assertAllClose(-np.inf, special_math_ops.expint(0.)) self.assertTrue(np.isnan(self.evaluate(special_math_ops.expint(np.nan)))) # Check that the domain of definition is [0, inf) self.assertTrue( np.all( np.isnan( self.evaluate( special_math_ops.expint( np.random.uniform(-20., -1., size=int(1e3)))))))
def test_expint_larger(self, dtype): x = np.random.uniform(1., 50., size=int(1e4)).astype(dtype) try: from scipy import special # pylint: disable=g-import-not-at-top self.assertAllClose( special.expi(x), self.evaluate(special_math_ops.expint(x))) except ImportError as e: tf_logging.warn('Cannot test special functions: %s' % str(e))