@@ -11,6 +11,7 @@ class TestLosses(unittest.TestCase):
1111
1212 def test_kl_div_loss (self ):
1313 self .assertTrue (can_run_metal ())
14+ mx .random .seed (0 )
1415
1516 logits_q = mx .random .uniform (shape = (4 , 8 , 4000 ), dtype = mx .float32 )
1617 logits_p = mx .random .uniform (shape = (4 , 8 , 4000 ), dtype = mx .float32 )
@@ -23,6 +24,7 @@ def test_kl_div_loss(self):
2324
2425 def test_js_div_loss (self ):
2526 self .assertTrue (can_run_metal ())
27+ mx .random .seed (0 )
2628
2729 logits_q = mx .random .uniform (shape = (4 , 8 , 4000 ), dtype = mx .float32 )
2830 logits_p = mx .random .uniform (shape = (4 , 8 , 4000 ), dtype = mx .float32 )
@@ -35,6 +37,7 @@ def test_js_div_loss(self):
3537
3638 def test_kl_div_loss_vjp (self ):
3739 self .assertTrue (can_run_metal ())
40+ mx .random .seed (0 )
3841
3942 logits_q = mx .random .uniform (shape = (4 , 8 , 4000 ), dtype = mx .float32 )
4043 logits_p = mx .random .uniform (shape = (4 , 8 , 4000 ), dtype = mx .float32 )
@@ -48,6 +51,7 @@ def test_kl_div_loss_vjp(self):
4851
4952 def test_js_div_loss_vjp (self ):
5053 self .assertTrue (can_run_metal ())
54+ mx .random .seed (0 )
5155
5256 logits_q = mx .random .uniform (shape = (4 , 8 , 4000 ), dtype = mx .float32 )
5357 logits_p = mx .random .uniform (shape = (4 , 8 , 4000 ), dtype = mx .float32 )
0 commit comments