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

Method test_normal

python/tests/test_init.py:22–31  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

20 self.assertEqual(result.dtype, dtype)
21
22 def test_normal(self):
23 mean = 0.0
24 std = 1.0
25 for dtype in [mx.float32, mx.float16]:
26 initializer = init.normal(mean, std, dtype=dtype)
27 for shape in [(3,), (3, 3), (3, 3, 3)]:
28 result = initializer(mx.array(np.empty(shape)))
29 with self.subTest(shape=shape):
30 self.assertEqual(result.shape, shape)
31 self.assertEqual(result.dtype, dtype)
32
33 def test_uniform(self):
34 low = -1.0

Callers

nothing calls this directly

Calls 3

initializerFunction · 0.85
arrayMethod · 0.60
emptyMethod · 0.45

Tested by

no test coverage detected