lululxvi / deepxde

A library for scientific machine learning and physics-informed learning
https://deepxde.readthedocs.io
GNU Lesser General Public License v2.1
2.47k stars 712 forks source link

Jax transform bug #1717

Closed bonneted closed 2 months ago

bonneted commented 2 months ago

The previous update to handle transform with Jax was not working to compute the Hessian. In that case, the output of the Jacobian is reused to compute the Hessian. There was an index error because squeeze make a one element array 0D but we actually want to keep one dimension. Changing the reshape(-1) solved it :

function       |  x.shape
.squeeze:        (1,1) --> ()
.reshape(-1):    (1,1) --> (1,)

I also implemented Jax on Helmotz equation example