Skip to content

Commit 09ee955

Browse files
committed
add unit test
1 parent 19bd6b3 commit 09ee955

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

tests/test-models/test_dirichlet_process_sample.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,5 +47,16 @@ def test_alpha_1d_base2d(self):
4747
_test([5], tf.constant([0.2, 1.5]), Normal,
4848
mu=tf.zeros([3, 4]), sigma=tf.ones([3, 4]))
4949

50+
def test_persistent_state(self):
51+
with self.test_session() as sess:
52+
dp = DirichletProcess(0.1, Normal, mu=0.0, sigma=1.0)
53+
x = dp.sample(5)
54+
y = dp.sample(5)
55+
x_data, y_data, theta = sess.run([x, y, dp.theta])
56+
for sample in x_data:
57+
self.assertTrue(sample in theta)
58+
for sample in y_data:
59+
self.assertTrue(sample in theta)
60+
5061
if __name__ == '__main__':
5162
tf.test.main()

0 commit comments

Comments
 (0)