-
Notifications
You must be signed in to change notification settings - Fork 159
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
BUG: Issue with wrapping Firedrake interpolation to vertex-only mesh in PyTorch #3709
Comments
The original issue in the interpolation from However, the problem persists when the action of the adjoint is considered: continue_annotation()
with set_working_tape() as _:
w = Cofunction(vertex_only_fs.dual())
interpolator = interpolate(TestFunction(fs), vertex_only_fs)
self._patch_to_function = fem_operator(
ReducedFunctional(assemble(action(adjoint(interpolator), w)), Control(w)))
pause_annotation() When I run this (with updated Firedrake from 5 Aug 2024) I get the following warning:
See here for an updated full MWE which illustrates the issue. |
Some further observations: I added some code in an extended version of the MWE which for a linear layer |
Describe the bug
I tried to wrap the interpolation from a function on the P1 space
fs
to a set of points (defined via a DG0 function spacevertex_only_fs
on a vertex-only mesh) inside atorch.nn.Module
. For this I used:and then call this in the
forward(self,x)
method of a class derived fromtorch.nn.Module
as. The code crashes with the following error message below.
Steps to Reproduce
Steps to reproduce the behavior:
Minimal working example: mwe.txt
To run this, use
python mwe.py
Expected behavior
I would expect that the code completes without crashing.
Error message
The final error message is (see error.txt for full error message):
Add error message with full backtrace, or log.
Please add these as text using three backticks (`) for highlighting.
Please do not add screenshots unless the bug is purely graphical.
Environment:
firedrake-status
: firedrake_status.txtAdditional Info
Discussed this issue with Nacime Bouziani on 25 Jul 2024. In the call, we actually looked at the transpose of the operation (mapping from the vertex-only function space to the original function space), but - contrary to what I thought - the issue also arises in the operation itself, as described above.
The text was updated successfully, but these errors were encountered: