From 6f4dda18c54f795727ff9c84a1f8875d7fae6fa6 Mon Sep 17 00:00:00 2001 From: Mingrui Zhang <33411325+erizmr@users.noreply.github.com> Date: Sat, 10 Dec 2022 11:31:46 +0800 Subject: [PATCH] [example] Fix jacobian example (#6849) Issue: #6733 The the grad field of variable at the left side of the global store will be cleared after #6579. Change to atomic add sort the issue. --- python/taichi/examples/autodiff/jacobian.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/taichi/examples/autodiff/jacobian.py b/python/taichi/examples/autodiff/jacobian.py index dfd479457d6ad..70e6b51b0b9b9 100644 --- a/python/taichi/examples/autodiff/jacobian.py +++ b/python/taichi/examples/autodiff/jacobian.py @@ -15,7 +15,7 @@ def func(): for j in range(N_loss): for i in range(N_param): - losses[j] = ti.sin(j / 16 * np.pi) * ti.sin( + losses[j] += ti.sin(j / 16 * np.pi) * ti.sin( i / 16 * np.pi) * params[i]