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
+20
View File
@@ -0,0 +1,20 @@
import unittest
import numpy as np
from prml import nn
class TestReshape(unittest.TestCase):
def test_reshape(self):
self.assertRaises(ValueError, nn.reshape, 1, (2, 3))
x = np.random.rand(2, 6)
p = nn.Parameter(x)
y = p.reshape(3, 4)
self.assertTrue((x.reshape(3, 4) == y.value).all())
y.backward(np.ones((3, 4)))
self.assertTrue((p.grad == np.ones((2, 6))).all())
if __name__ == '__main__':
unittest.main()