-
Notifications
You must be signed in to change notification settings - Fork 777
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
base: master
Are you sure you want to change the base?
Conversation
Update example of heat equation (lululxvi#706)
Add document for Lorenz inverse with exogenous input (lululxvi#709)
OperatorPredictor supports backends tensorflow.compat.v1, tensorflow,…
… method of Lr decay in Pytorch
Support Python 3.12
This PR should only modify dde.gradients, not pde_operator.py. |
update to latest version
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 |
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 |
deepxde/gradients/gradients.py
Outdated
When `ys` has shape (batch_size, dim_y), the output shape is (batch_size, 1). | ||
When `ys` has shape (batch_size_out, batch_size, dim_y), the output shape is | ||
(batch_size_out, batch_size, 1) if forward-mode autodiff is used or | ||
(batch_size, 1) if reverse-mode autodiff is used. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For reverse-mode, if it is (batch_size, 1), then does it mean that reverse mode doesn't support batch_size_out?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reverse mode does support batch_size_out. In reverse mode, the gradient has the same shape as the input since it uses vector jacobian product. so when the ys
has the shape (batch_size, dim_y), the shape of gradient is (batch_size, 1) no matter reverse_mode or forward-mode is used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand. If revise-mode supports batch_size_out, then why the output is (batch_size, 1)? Where is batch_size_out?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reverse-mode support ys
shape has the shape (batch_size_out, batch_size, dim_y) and xs
has the shape (batch_size, dim_x). That's this PR care about, 3D output.
No description provided.