Skip to content

Fix device mismatch for residual weights in RBAPINN#614

Merged
dario-coscia merged 1 commit into
mathLab:devfrom
GiovanniCanali:fix_rba_pinn
Jul 31, 2025
Merged

Fix device mismatch for residual weights in RBAPINN#614
dario-coscia merged 1 commit into
mathLab:devfrom
GiovanniCanali:fix_rba_pinn

Conversation

@GiovanniCanali

Copy link
Copy Markdown
Collaborator

Description

This PR fixes #613.

Checklist

  • Code follows the project’s Code Style Guidelines
  • Tests have been added or updated
  • Documentation has been updated if necessary
  • Pull request is linked to an open issue

@GiovanniCanali GiovanniCanali self-assigned this Jul 28, 2025
@GiovanniCanali GiovanniCanali added bug Something isn't working high priority Higher priority pr-to-fix Label for PR that needs modification labels Jul 28, 2025
@GiovanniCanali GiovanniCanali changed the base branch from master to dev July 28, 2025 08:09
@GiovanniCanali GiovanniCanali marked this pull request as ready for review July 28, 2025 08:55
@GiovanniCanali GiovanniCanali added pr-to-review Label for PR that are ready to been reviewed and removed pr-to-fix Label for PR that needs modification labels Jul 28, 2025
# Compute normalized residuals
res = residuals[cond]
res_abs = res.abs()
res_abs = torch.linalg.vector_norm(res, ord=2, dim=1, keepdim=True)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Why is it changing from absolute value to norm l2?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This is done to ensure that the RBAPINN solver works also for a condition associated with a SystemEquation. Indeed, the weights' update must be a scalar.

Notice that when dealing with a single Equation, the L2 norm along the first dimension is the same as the absolute value.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@dario-coscia dario-coscia merged commit 419ac7f into mathLab:dev Jul 31, 2025
18 of 19 checks passed
@GiovanniCanali GiovanniCanali deleted the fix_rba_pinn branch August 28, 2025 07:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working high priority Higher priority pr-to-review Label for PR that are ready to been reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Wrong device for residual-based weights in RBAPINN

3 participants