chore: import upstream snapshot with attribution

This commit is contained in:
wehub-resource-sync
2026-07-13 13:30:25 +08:00
commit f19b2512d7
562 changed files with 38082 additions and 0 deletions
@@ -0,0 +1,21 @@
import unittest
import numpy as np
from prml import nn
class TestExponential(unittest.TestCase):
def test_exponential(self):
np.random.seed(1234)
obs = np.random.gamma(1, 1 / 0.5, size=1000)
a = nn.Parameter(0)
for _ in range(100):
a.cleargrad()
x = nn.random.Exponential(nn.softplus(a), data=obs)
x.log_pdf().sum().backward()
a.value += a.grad * 0.001
self.assertAlmostEqual(x.rate.value, 0.475135117)
if __name__ == '__main__':
unittest.main()