We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Describe the bug I have a developement build on my MacOS, and didn't manage to pass the test of test_ad_basic.py.
test_ad_basic.py
Logs shown as below:
To Reproduce pytest test_ad_basic.py
pytest test_ad_basic.py
Logs
========================= FAILURES ========================== ____________________ test_trigonometric _____________________ args = (), kwargs = {} def wrapper(*args, **kwargs): if has_autograd: > func(*args, **kwargs) test_ad_basics.py:17: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ test_ad_basics.py:80: in test_trigonometric grad_test(lambda x: ti.sin(x), lambda x: np.sin(x)) test_ad_basics.py:50: in grad_test impl() ../../python/taichi/lang/__init__.py:449: in wrapped test(*test_args, **test_kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ @ti.all_archs_with(default_fp=default_fp) def impl(): print(f'arch={ti.cfg.arch} default_fp={ti.cfg.default_fp}') x = ti.var(default_fp) y = ti.var(default_fp) ti.root.dense(ti.i, 1).place(x, x.grad, y, y.grad) @ti.kernel def func(): for i in x: y[i] = tifunc(x[i]) v = 0.234 y.grad[0] = 1 x[0] = v func() func.grad() > assert y[0] == approx(npfunc(v)) E assert 0.23188334703445435 == 0.2318703549116868 ± 2.3e-07 E + where 0.2318703549116868 ± 2.3e-07 = approx(0.2318703549116868) E + where 0.2318703549116868 = <function test_trigonometric.<locals>.<lambda> at 0x123d80378>(0.234) test_ad_basics.py:47: AssertionError ------------------- Captured stdout call -------------------- Running test on arch=Arch.x64 [Taichi] Starting on arch=x64 arch=Arch.x64 default_fp=DataType.float32 [Taichi] materializing... Running test on arch=Arch.metal [Taichi] Starting on arch=metal arch=Arch.metal default_fp=DataType.float32 [Taichi] materializing... Running test on arch=Arch.x64 [Taichi] Starting on arch=x64 arch=Arch.x64 default_fp=DataType.float32 [Taichi] materializing... Running test on arch=Arch.metal [Taichi] Starting on arch=metal arch=Arch.metal default_fp=DataType.float32 [Taichi] materializing...
The text was updated successfully, but these errors were encountered:
assert 0.23188334703445435 == 0.2318703549116868 ± 2.3e-07
As you can see the error here is really small, that it should not fail at all.
I think we can do a mock in ti.approx to increase the rel tolerance a little bit like OpenGL does:
ti.approx
rel
taichi/python/taichi/testing.py
Lines 22 to 23 in bf403b5
Sorry, something went wrong.
`` As you can see the error here is really small, that it should not fail at all.
``
Yes! It's the same as I guess. It's always hard to find a nice "epsilon".
@Rullec would you do the same thing to metal? A good issue for you :)
Thanks! I will try to handle it under all of your guidence.
Btw, The other 3 tests failed on my mac as well:
[error] error when testing test_bitmasked.py, return 256 [error] error when testing test_global_store_grad.py, return 1280 [error] error when testing test_ad_basics.py, return 256 [error] error when testing test_element_wise.py, return 256
I will double check them later, and if they are not my wrong, would it be proper to report them as well in this issue?
k-ye
Rullec
Successfully merging a pull request may close this issue.
Describe the bug
I have a developement build on my MacOS, and didn't manage to pass the test of
test_ad_basic.py
.Logs shown as below:
To Reproduce
pytest test_ad_basic.py
Logs
The text was updated successfully, but these errors were encountered: