deepxde icon indicating copy to clipboard operation
deepxde copied to clipboard

AttributeError on auxiliary_var_fn obtaining residuals using PI-DeepONet

Open PhilippBrendel opened this issue 1 year ago • 3 comments

Hi,

I am trying to get the residuals during/after training a DeepONet. Using the same approach that works in the "standard" PINN case

residuals = np.absolute(self.model.predict(x, callbacks=..., operator=self.pde))

yields the following Error:

File "/.../deepxde/model.py", line 883, in predict aux_vars = self.data.auxiliary_var_fn(x).astype(config.real(np)) AttributeError: 'PDEOperatorCartesianProd' object has no attribute 'auxiliary_var_fn'

As to be expected, e.g. from the 1D poisson tutorial , the code is trying to access PDEOperatorCartesianProd object instead of the TimePDE object with which the model would be initialized in a standard PINN example

Enforcing the correct underlying TimePDE object to be used here via a direct source code change does not work either as the attribute seems to be None.

File "/home/users/brendel/.local/lib/python3.9/site-packages/deepxde/model.py", line 884, in predict aux_vars = self.data.pde.auxiliary_var_fn(x).astype(config.real(np)) TypeError: 'NoneType' object is not callable

Is this a bug or can someone help me out here?

Best, Philipp

PhilippBrendel avatar Dec 12 '23 15:12 PhilippBrendel

model.predict cannot work with PDEOperatorCartesianProd yet. It is not a bug, but needs more code implementation. You may use other numerical methods to get the error now.

lululxvi avatar Dec 31 '23 19:12 lululxvi

Dear @lululxvi, thank you for the clarification, I will check other options!

I have a slightly related question that you might be able to answer quickly:

Can PDEOperatorCartesianProd work with MIONetCartesianProd out-of-the-box or do I need to create my own version of it supporting MIONet? I tried to use it that way but it's giving me shape errors on standard boundary conditions.

So far I have only found this repo for data-driven approach with MIONet, but I want to train a physics-informed MIONet, see e.g. this work.

Best, Philipp

PhilippBrendel avatar Jan 04 '24 10:01 PhilippBrendel

Can PDEOperatorCartesianProd work with MIONetCartesianProd out-of-the-box?

No. You need to implement your version.

lululxvi avatar Jan 24 '24 00:01 lululxvi