jayroxis / PINNs

PyTorch Implementation of Physics-informed Neural Networks
515 stars 128 forks source link

Coefficient (0.01 / math.pi) without parentheses #5

Open ANTAGNIST opened 1 year ago

ANTAGNIST commented 1 year ago
class Net:
    ...
    def loss_func(self):
        ...
        loss_pde = self.criterion(du_dt + u.squeeze() * du_dx, 0.01 / math.pi * du_dxx)
        ...
        return loss

Here the code of loss_pde = self.criterion(du_dt + u.squeeze() * du_dx, 0.01 / math.pi * du_dxx) of coefficient 0.01 / math.pi need to be (0.01 / math.pi) , and the code will be loss_pde = self.criterion(du_dt + u.squeeze() * du_dx, (0.01 / math.pi) * du_dxx). Then the result will change. It's so amazing.

jayroxis commented 1 year ago

I am not aware of that the change of parentheses would result in a change in the result. Did you fix the random seed to test out whether it is due to randomness?

ANTAGNIST commented 1 year ago

I think it doesn't matter with the random seed cause

  1. As the coefficients decrease, the values start to get out of fit.
  2. I run the code over 3 times in every coefficients change without set torch.manual.seed. As a result, it's related to coefficients.