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

Cover parser by tests #369

Open
KirillZubov opened this issue Aug 13, 2021 · 0 comments
Open

Cover parser by tests #369

KirillZubov opened this issue Aug 13, 2021 · 0 comments

Comments

@KirillZubov
Copy link
Member

KirillZubov commented Aug 13, 2021

create a bunch of tests covering the parser to keep track of that the symbolic part is working correctly
MWE

@parameters x
@variables u(..)

Dx = Differential(x)
eq = Dx(u(x)) ~ 0.
bcs = [u(0.) ~ u(0.)]
domains = [x  Interval(0.0,1.0)]
chain = FastChain((x,p) -> x.^2)

chain([1],Float32[])
strategy_ = NeuralPDE.GridTraining(0.1)
discretization = NeuralPDE.PhysicsInformedNN(chain,strategy_)
pde_system = PDESystem(eq,bcs,domains,[x],[u])
prob = NeuralPDE.discretize(pde_system,discretization)

train_data =prob.f.f.loss_function.pde_loss_function.pde_loss_functions.contents[1].train_set
inner_loss =prob.f.f.loss_function.pde_loss_function.pde_loss_functions.contents[1].loss_function

dudx(x) = @. 2*x
@test inner_loss(train_data, Float32[])  dudx(train_data) rtol = 0.001
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants