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

Method test_constant

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

Source from the content-addressed store, hash-verified

9
10class TestInit(mlx_tests.MLXTestCase):
11 def test_constant(self):
12 value = 5.0
13
14 for dtype in [mx.float32, mx.float16]:
15 initializer = init.constant(value, dtype)
16 for shape in [(3,), (3, 3), (3, 3, 3)]:
17 result = initializer(mx.array(mx.zeros(shape)))
18 with self.subTest(shape=shape):
19 self.assertEqual(result.shape, shape)
20 self.assertEqual(result.dtype, dtype)
21
22 def test_normal(self):
23 mean = 0.0

Callers

nothing calls this directly

Calls 2

initializerFunction · 0.85
arrayMethod · 0.60

Tested by

no test coverage detected