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

rename train_x_all to train_x_pde #1113

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

g-w1
Copy link
Contributor

@g-w1 g-w1 commented Jan 15, 2023

This resolves a TODO

Was split off from #1108

@lululxvi
Copy link
Owner

have you double-checked if all classes using train_x_all has been revised?

@g-w1
Copy link
Contributor Author

g-w1 commented Jan 16, 2023

Grepping for train_x_all returns nothing on this branch. However, I just realized that in #1108 I use train_x_pde, so it would make sense to merge this pull request before that one since it depends on this one.

@@ -100,9 +100,7 @@ def __init__(

self.auxiliary_var_fn = auxiliary_var_function

# TODO: train_x_all is used for PDE losses. It is better to add train_x_pde
# explicitly.
Copy link
Owner

Choose a reason for hiding this comment

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

As commented here, it is better to add train_x_pde, not replace train_x_all with train_x_pde. In some cases, we may actually use the meaning of train_x_all, but I am not sure which case. Need to look at all the code carefully.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have looked over the code, and I can't find a place where train_x_all does not contain PDE residual points.

If I added train_x_pde in addition to train_x_all, what would be different about them? The only thing that I can think of is that train_x_pde would only contain points in the domain as opposed to train_x_all also containing points on the boundary (or on the initial conditions in TimePDE).

What do you recommend for how to add it?

Copy link
Owner

@lululxvi lululxvi Apr 21, 2023

Choose a reason for hiding this comment

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

train_x_all contains all points (unordered, and does not have duplication). train_x_bc is the points for BC losses (may have have duplication). There are cases where there are only BC losses and no PDE losses. So, it is better to add train_x_pde. That is why we need the following if

if self.pde is not None:

So inside this if, we should add

self.train_x_pde = train_x_all  # Do deep copy

Otherwise, self.train_x_pde is an empty array. We may also need to modify other places.

This makes the code clean and easier to understand. But it uses more memory.

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.

None yet

2 participants