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

dde.gradients support 3D outputs #1928

Open
wants to merge 230 commits into
base: master
Choose a base branch
from
Open

Conversation

Jerry-Jzy
Copy link
Contributor

No description provided.

Jerry-Jzy and others added 30 commits May 27, 2022 16:39
Update example of heat equation (lululxvi#706)
Add document for Lorenz inverse with exogenous input (lululxvi#709)
OperatorPredictor supports backends tensorflow.compat.v1, tensorflow,…
@Jerry-Jzy Jerry-Jzy closed this Jan 3, 2025
@Jerry-Jzy Jerry-Jzy reopened this Jan 5, 2025
@lululxvi
Copy link
Owner

lululxvi commented Jan 5, 2025

You need to test all backends.

@Jerry-Jzy
Copy link
Contributor Author

You need to test all backends.

The only case where the output is 3D is shown to be supported only by tensorflow v2 and pytorch

https://github.com/lululxvi/deepxde/blob/master/examples/operator/stokes_aligned_pideeponet.py

@lululxvi
Copy link
Owner

lululxvi commented Jan 5, 2025

Not necessary testing PI-DeepONet. You can manually construct a function, and jus test if dde.gradients works correctly.

@Jerry-Jzy
Copy link
Contributor Author

Not necessary testing PI-DeepONet. You can manually construct a function, and jus test if dde.gradients works correctly.

I have tested pytorch, tf v2, paddle, jax. I don't have access to the environment for tf v1

@@ -21,11 +21,11 @@ def __call__(self, i=None, j=None):
# Compute J[i, :]
if i not in self.J:
if backend_name in ["tensorflow.compat.v1", "tensorflow"]:
y = self.ys[:, i : i + 1] if self.dim_y > 1 else self.ys
y = self.ys[..., i : i + 1] if self.dim_y > 1 else self.ys
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since reverse mode doesn't support 3D anyway, we don't need to modify this file.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok

"""
if config.autodiff == "reverse":
if bkd.ndim(ys) == 3:
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Raise this error in gradients_reverse.py

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure

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

Successfully merging this pull request may close these issues.

2 participants