(self)
| 1002 | self.assertEqual(y.dtype, mx.float32) |
| 1003 | |
| 1004 | def test_softplus(self): |
| 1005 | x = mx.array([1.0, -1.0, 0.0]) |
| 1006 | y = nn.softplus(x) |
| 1007 | epsilon = 1e-4 |
| 1008 | expected_y = mx.array([1.3133, 0.3133, 0.6931]) |
| 1009 | self.assertTrue(mx.all(mx.abs(y - expected_y) < epsilon)) |
| 1010 | self.assertEqual(y.shape, (3,)) |
| 1011 | self.assertEqual(y.dtype, mx.float32) |
| 1012 | |
| 1013 | def test_softsign(self): |
| 1014 | x = mx.array([1.0, -1.0, 0.0]) |