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

Method test_flatten

python/tests/test_ops.py:2409–2416  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

2407 self.assertTrue(np.array_equal(c, np_c))
2408
2409 def test_flatten(self):
2410 x = mx.zeros([2, 3, 4])
2411 self.assertEqual(mx.flatten(x).shape, (2 * 3 * 4,))
2412 self.assertEqual(mx.flatten(x, start_axis=1).shape, (2, 3 * 4))
2413 self.assertEqual(mx.flatten(x, end_axis=1).shape, (2 * 3, 4))
2414 self.assertEqual(x.flatten().shape, (2 * 3 * 4,))
2415 self.assertEqual(x.flatten(start_axis=1).shape, (2, 3 * 4))
2416 self.assertEqual(x.flatten(end_axis=1).shape, (2 * 3, 4))
2417
2418 def test_clip(self):
2419 a = np.array([1, 4, 3, 8, 5], np.int32)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected