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

Method test_irregular_alignments

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

Source from the content-addressed store, hash-verified

3189 self.assertTrue(mx.isnan(out))
3190
3191 def test_irregular_alignments(self):
3192 # Unaligned unary op
3193 a = mx.ones((64, 1))
3194 b = -a[1:]
3195 self.assertTrue(mx.all(b == -1.0))
3196
3197 # Unaligned binary op
3198 a = mx.ones((64, 1))
3199 b = a[1:]
3200 c = b + b
3201 self.assertTrue(mx.all(c == 2.0))
3202
3203 # Unaligned ternary op
3204 a = mx.ones((64, 1))
3205 b = mx.zeros((63, 1))
3206 c = mx.ones((63, 1)).astype(mx.bool_)
3207 d = mx.where(c, a[1:], b)
3208 self.assertTrue(mx.all(d == 1.0))
3209
3210 def test_integer_power(self):
3211 x = mx.power(2, mx.array([8, 8, 8, 8, 8, 8, 8, 8]))

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected