chore: import upstream snapshot with attribution
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
import unittest
|
||||
from prml import nn
|
||||
|
||||
|
||||
class TestSigmoid(unittest.TestCase):
|
||||
|
||||
def test_sigmoid(self):
|
||||
self.assertEqual(nn.sigmoid(0).value, 0.5)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -0,0 +1,13 @@
|
||||
import unittest
|
||||
import numpy as np
|
||||
from prml import nn
|
||||
|
||||
|
||||
class TestSoftmax(unittest.TestCase):
|
||||
|
||||
def test_softmax(self):
|
||||
self.assertTrue(np.allclose(nn.softmax(np.ones(4)).value, 0.25))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -0,0 +1,13 @@
|
||||
import unittest
|
||||
import numpy as np
|
||||
from prml import nn
|
||||
|
||||
|
||||
class TestSoftplus(unittest.TestCase):
|
||||
|
||||
def test_softplus(self):
|
||||
self.assertEqual(nn.softplus(0).value, np.log(2))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
import unittest
|
||||
from prml import nn
|
||||
|
||||
|
||||
class TestTanh(unittest.TestCase):
|
||||
|
||||
def test_tanh(self):
|
||||
self.assertEqual(nn.tanh(0).value, 0)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
Reference in New Issue
Block a user