mirror of
https://github.com/ml-explore/mlx.git
synced 2025-09-01 12:49:44 +08:00
Fix view scalar bug segfault (#1603)
* fix view scalar bug * fix view scalar bug * one more fix
This commit is contained in:
@@ -2532,6 +2532,10 @@ class TestOps(mlx_tests.MLXTestCase):
|
||||
self.assertTrue(np.array_equal(np.array(out_mlx), out_np))
|
||||
|
||||
def test_view(self):
|
||||
# Check scalar
|
||||
out = mx.array(1, mx.int8).view(mx.uint8).item()
|
||||
self.assertEqual(out, 1)
|
||||
|
||||
a = mx.random.randint(shape=(4, 2, 4), low=-100, high=100)
|
||||
a_np = np.array(a)
|
||||
|
||||
|
Reference in New Issue
Block a user