mirror of
https://github.com/tinygrad/tinygrad.git
synced 2026-06-11 23:46:02 +08:00
fix mean underflow for half tensor (#4377)
* fix mean underflow for half tensor divide only the reduce factor. added unit test and non-nan assertion in resnet training. also added a failed test cast for symbolic shape var * skip for python backend
This commit is contained in:
@@ -32,6 +32,14 @@ class TestTensorVariable(unittest.TestCase):
|
||||
ret = t.mean().item()
|
||||
assert ret == 1
|
||||
|
||||
@unittest.skip("symbolic var isn't supported")
|
||||
def test_symbolic_var(self):
|
||||
vv = Variable("a", 1, 10)
|
||||
vv.bind(2)
|
||||
t = Tensor.ones(2, 2).contiguous().reshape(2, vv)
|
||||
ret = t.var().item()
|
||||
assert ret == 0
|
||||
|
||||
def test_symbolic_mean_2d(self):
|
||||
vv = Variable("a", 1, 10)
|
||||
vv.bind(2)
|
||||
|
||||
Reference in New Issue
Block a user