def test_random_normal(self): mean = 0.0 std = 1.0 rand = KTF.get_value(KTF.random_normal((1000, 1000), mean=mean, std=std)) assert rand.shape == (1000, 1000) assert np.abs(np.mean(rand) - mean) < 0.01 assert np.abs(np.std(rand) - std) < 0.01 rand = KTF.get_value(KTF.random_normal((1000, 1000), mean=mean, std=std)) assert rand.shape == (1000, 1000) assert np.abs(np.mean(rand) - mean) < 0.01 assert np.abs(np.std(rand) - std) < 0.01
def test_random_uniform(self): mean = 0. std = 1. rand = KTF.get_value(KTF.random_normal((1000, 1000), mean=mean, std=std)) assert(rand.shape == (1000, 1000)) assert(np.abs(np.mean(rand) - mean) < 0.01) assert(np.abs(np.std(rand) - std) < 0.01) rand = KTF.get_value(KTF.random_normal((1000, 1000), mean=mean, std=std)) assert(rand.shape == (1000, 1000)) assert(np.abs(np.mean(rand) - mean) < 0.01) assert(np.abs(np.std(rand) - std) < 0.01)
def test_random_normal(self): mean = 0. std = 1. rand = KTF.eval(KTF.random_normal((1000, 1000), mean=mean, stddev=std)) assert rand.shape == (1000, 1000) assert np.abs(np.mean(rand) - mean) < 0.01 assert np.abs(np.std(rand) - std) < 0.01 rand = KTH.eval(KTH.random_normal((1000, 1000), mean=mean, stddev=std)) assert rand.shape == (1000, 1000) assert np.abs(np.mean(rand) - mean) < 0.01 assert np.abs(np.std(rand) - std) < 0.01