mirror of
https://github.com/tinygrad/tinygrad.git
synced 2026-01-24 22:38:16 -05:00
check the input length into argfix (#3610)
* check the input length into argfix it's possible to overlook setting keyword for kwargs and argfix silently truncates input * add test
This commit is contained in:
@@ -214,6 +214,13 @@ class TestTinygrad(unittest.TestCase):
|
||||
self.assertEqual(Tensor.empty(1,10,20).shape, (1,10,20))
|
||||
self.assertEqual(Tensor.empty((10,20,40)).shape, (10,20,40))
|
||||
|
||||
with self.assertRaises(ValueError):
|
||||
Tensor.zeros((2, 2), 2, 2)
|
||||
with self.assertRaises(ValueError):
|
||||
Tensor.zeros((2, 2), (2, 2))
|
||||
with self.assertRaises(ValueError):
|
||||
Tensor.randn((128, 128), 0.0, 0.01)
|
||||
|
||||
def test_numel(self):
|
||||
assert Tensor.randn(10, 10).numel() == 100
|
||||
assert Tensor.randn(1,2,5).numel() == 10
|
||||
|
||||
Reference in New Issue
Block a user