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

vmap for build_jax_fem_eval? #14

Open
nguyenvanhaibk92 opened this issue Dec 25, 2021 · 0 comments
Open

vmap for build_jax_fem_eval? #14

nguyenvanhaibk92 opened this issue Dec 25, 2021 · 0 comments

Comments

@nguyenvanhaibk92
Copy link

nguyenvanhaibk92 commented Dec 25, 2021

Hi Ivan,
in the notebook, we have the function

@build_jax_fem_eval(solve_templates)
def fenics_solve(f):

I try to use jax.vmap. It works in the test files, where we just want to compute outputs of u. However, inside the neural network

def eval_nn(net_params):
f_nn = np.ravel(net_apply(net_params, W.tabulate_dof_coordinates()))
u = vmap(fenics_solve(f_nn))
norm_u = np.linalg.norm(u)
return norm_u

but it does not work. For example, in the case that we deal with multiple samples.
Can you give me further guidance?

Thank you.

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

1 participant