Skip to content
New issue

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

Mass spring loss is nan after repeatedly running #61

Open
alansun17904 opened this issue Dec 14, 2022 · 2 comments
Open

Mass spring loss is nan after repeatedly running #61

alansun17904 opened this issue Dec 14, 2022 · 2 comments

Comments

@alansun17904
Copy link

I am running taichi 1.2.1 with arm64 arch and Python 3.10.8. I've written some code that repeatedly calls the mass_spring simulation with different mass spring layouts and the loss of mass spring becomes nan when this happens. However, this behavior is not deterministic, sometimes it happens after 1 iteration other times after 4-5 with it not failing on a particular mass_spring layout.
Before and after each call to mass_spring main, I am reloading the mass_spring file to re-initialize the variables and after I am tearing down with ti.reset().
Could someone please shed some light on this error?

@erizmr
Copy link
Contributor

erizmr commented Dec 16, 2022

Hi @alansun17904 , if it is possible to share a minimal repro code?

@alansun17904
Copy link
Author

alansun17904 commented Dec 17, 2022

Thanks for the quick response. I modified main by adding the following lines

clear()
forward(None, visualize=False)
clear()
return loss[None]

Then, I am calling main in another module through

from importlib import 
for _ in range(n):
    reload(mass_spring)
    mass_spring.main()
    ti.reset()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants