mirror of
https://github.com/ml-explore/mlx.git
synced 2025-07-19 23:51:14 +08:00
Fix the alibi test that was left unchanged (#252)
This commit is contained in:
parent
0aa65c7a6b
commit
1d053e0d1d
@ -571,16 +571,15 @@ class TestNN(mlx_tests.MLXTestCase):
|
||||
self.assertTrue(y.dtype, mx.float16)
|
||||
|
||||
def test_alibi(self):
|
||||
for kwargs in [{"num_heads": 8}]:
|
||||
alibi = nn.ALibi(**kwargs)
|
||||
shape = [1, 8, 20, 20]
|
||||
x = mx.random.uniform(shape=shape)
|
||||
y = alibi(x)
|
||||
self.assertTrue(y.shape, shape)
|
||||
self.assertTrue(y.dtype, mx.float32)
|
||||
alibi = nn.ALiBi()
|
||||
shape = [1, 8, 20, 20]
|
||||
x = mx.random.uniform(shape=shape)
|
||||
y = alibi(x)
|
||||
self.assertTrue(y.shape, shape)
|
||||
self.assertTrue(y.dtype, mx.float32)
|
||||
|
||||
y = alibi(x.astype(mx.float16))
|
||||
self.assertTrue(y.dtype, mx.float16)
|
||||
y = alibi(x.astype(mx.float16))
|
||||
self.assertTrue(y.dtype, mx.float16)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
Loading…
Reference in New Issue
Block a user