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

Method test_softplus

python/tests/test_nn.py:1004–1011  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

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])

Callers

nothing calls this directly

Calls 1

arrayMethod · 0.60

Tested by

no test coverage detected