def test_log_sum_exp_1():
 rng = np.random.RandomState([2015, 2, 9])
 x = (1.0 + (rng.randn(5) / 10.0))
 naive = np.log(np.exp(x).sum())
 x = sharedX(x)
 stable = log_sum_exp(x).eval()
 assert np.allclose(naive, stable)

def test_log_sum_exp_1 ( ) : rng = np . random . RandomState ( [ 2015 , 2 , 9 ] ) x = ( 1.0 + ( rng . randn ( 5 ) / 10.0 ) ) naive = np . log ( np . exp ( x ) . sum ( ) ) x = sharedX ( x ) stable = log_sum_exp ( x ) . eval ( ) assert np . allclose ( naive , stable )
tests that the stable log sum exp matches the naive one for values near 1 .