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

Treating states properly, second encounter #605

Closed
YichengDWu opened this issue Sep 14, 2022 · 4 comments
Closed

Treating states properly, second encounter #605

YichengDWu opened this issue Sep 14, 2022 · 4 comments

Comments

@YichengDWu
Copy link
Member

I just realized that the recent PR #604 did not fix anything. As Phi is a mutable field of immutable PhysicsInformedNN. The related source code is a bit messy. Adapting states should be done inside PhysicsInformedNN. But there are too many situations to deal with and I don't want to fix it right away. For me, I just want to assume that the input chain is always a Lux.Chain, not vectors. If there are multiple dependent variables, then wrap them with another Chain, like Chain(u = chain_u, v = chain_v). We can use keys(chain)==depvars to check if there are multiple outputs. The advantage of doing this is that we can initialize the parameters and states at once. Then discretization.Phi should probably be a named tuple so we don't need to remember the order of dependent variables.

@ChrisRackauckas
Copy link
Member

I think that's reasonable. This was special cased before Chain could do that, and now that it can, we should aggressively simplify the code and interface.

@YichengDWu
Copy link
Member Author

It was a bad idea to wrap them in a new Chain. I was not thinking correctly. It should've been just a named tuple because initialstates and initialparameters both work on named tuples, and we can nicely call phi.u.

@YichengDWu
Copy link
Member Author

YichengDWu commented Sep 15, 2022

I guess simply putting Setsfield.@set! there can correctly mutate Phi.

@YichengDWu
Copy link
Member Author

Moved to #687

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