Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is an implementation of the SPINN model: https://jwcho5576.github.io/spinn.github.io/
The code for the network architecture (
snn.py
) is directly adapted from the original paper (https://github.com/stnamjef/SPINN)I've achieved really fast convergence with this implementation of SPINN compared to PINN (similar to the paper claim), for both forward and inverse quantification on the linear elastic plate problem.
Forward comparison :
https://github.com/lululxvi/deepxde/assets/53513604/499a961d-748c-458f-be99-56156b516ace
Inverse with PINN :
https://github.com/lululxvi/deepxde/assets/53513604/ab89554d-b82b-406a-8d73-05b3f72a3961
Inverse with SPINN :
https://github.com/lululxvi/deepxde/assets/53513604/07171442-ea03-48b4-87a6-8b5094f6809c
The implementation was more complicated than expected for the following reasons:
due to its architecture, SPINN takes an input of size n and outputs an array of size n**dim (it does the cartesian product of each coordinate) :
(n,2) --> SPINN --> n**2
This brings some difficulty with how inputs are handled in
data.pde
.Indeed, all inputs are concatenated (PDE and BCS points) and throw the net simultaneously.
So if we have
n_PDE
PDE points andn_BC
BC points we will end up with(n_PDE+n_BC)**2
points instead ofn_PDE**2+n_BC**2
I tried to find a workaround with minimal changes to
model.py
, and came up with the following:adding a
list_handler
decorator to theoutputs
function in JAX so that it can handle list inputs by applying the function to each input and then concatenates.I then modified the
pde.py
file by adding ais_SPINN
argument, if true, PDE and BC inputs are put together in a list instead of stacked. Thebcs_start
should also be modified as the outputs sizes no longer equal the inputs.I understand that this brings a lot of changes to
data.pde
, so another possibility is to create a separatedata
subclass dedicated to SPINN so that thedata.pde
class isn't overly complicated.