MCPcopy Create free account
hub / github.com/ml-explore/mlx / test_gumbel

Method test_gumbel

python/tests/test_random.py:292–303  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

290 )
291
292 def test_gumbel(self):
293 samples = mx.random.gumbel(shape=(100, 100))
294 self.assertEqual(samples.shape, (100, 100))
295 self.assertEqual(samples.dtype, mx.float32)
296 mean = 0.5772
297 # Std deviation of the sample mean is small (<0.02),
298 # so this test is pretty conservative
299 self.assertTrue(mx.abs(mx.mean(samples) - mean) < 0.2)
300
301 self.assertEqual(
302 mx.random.gumbel((1, 1)).dtype, mx.random.gumbel((1, 1), dtype=None).dtype
303 )
304
305 def test_categorical(self):
306 logits = mx.zeros((10, 20))

Callers

nothing calls this directly

Calls 1

meanMethod · 0.80

Tested by

no test coverage detected