Skip to content

Add pirate network#604

Merged
GiovanniCanali merged 1 commit into
mathLab:devfrom
GiovanniCanali:pirate_net
Jul 28, 2025
Merged

Add pirate network#604
GiovanniCanali merged 1 commit into
mathLab:devfrom
GiovanniCanali:pirate_net

Conversation

@GiovanniCanali
Copy link
Copy Markdown
Collaborator

Description

This PR fixes #603

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 21, 2025
@GiovanniCanali GiovanniCanali added enhancement New feature or request pr-to-fix Label for PR that needs modification labels Jul 21, 2025
@GiovanniCanali GiovanniCanali linked an issue Jul 21, 2025 that may be closed by this pull request
@GiovanniCanali GiovanniCanali force-pushed the pirate_net branch 2 times, most recently from 816b080 to a140784 Compare July 21, 2025 15:31
@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 21, 2025
@GiovanniCanali GiovanniCanali force-pushed the pirate_net branch 2 times, most recently from d7fd5d0 to 34e2565 Compare July 21, 2025 15:47
@GiovanniCanali GiovanniCanali marked this pull request as ready for review July 21, 2025 15:52
Copy link
Copy Markdown
Collaborator

@dario-coscia dario-coscia left a comment

Choose a reason for hiding this comment

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

Everything look fine to me! The only thing I am wondering is if we really need PirateNetBlock. The reason why I am saying this, is to avoid to populate too much the pina.model.block module. The block itself can just be put inside the PirateNet model, I doubt it can be used otherwise as standalone. This is the same reasoning we adopted for ResidualFeedForward where all the logic is inside the network since the block itself cannot be reused by other models.

Comment thread pina/model/block/pirate_network_block.py
@GiovanniCanali
Copy link
Copy Markdown
Collaborator Author

Everything look fine to me! The only thing I am wondering is if we really need PirateNetBlock. The reason why I am saying this, is to avoid to populate too much the pina.model.block module. The block itself can just be put inside the PirateNet model, I doubt it can be used otherwise as standalone. This is the same reasoning we adopted for ResidualFeedForward where all the logic is inside the network since the block itself cannot be reused by other models.

I agree with you, I can move the block definition to the same file of the PirateNet.

@dario-coscia
Copy link
Copy Markdown
Collaborator

Everything look fine to me! The only thing I am wondering is if we really need PirateNetBlock. The reason why I am saying this, is to avoid to populate too much the pina.model.block module. The block itself can just be put inside the PirateNet model, I doubt it can be used otherwise as standalone. This is the same reasoning we adopted for ResidualFeedForward where all the logic is inside the network since the block itself cannot be reused by other models.

I agree with you, I can move the block definition to the same file of the PirateNet.

Is it now ready for review?

@GiovanniCanali
Copy link
Copy Markdown
Collaborator Author

Hi @ndem0, @dario-coscia, @FilippoOlivo,
I have added the possibility to pass a custom embedding to the PirateNet. If None, the FourierFeatureEmbedding is used, with the parameters suggested by the paper.

I also update the doc for the forward of the block: U and V must have the same dimension as x.

I checked if the parameter alpha controlling the contribution of each block must be between 0 and 1. There is no such restriction in the original paper, so I did not modify this.

@GiovanniCanali GiovanniCanali merged commit caa67ac into mathLab:dev Jul 28, 2025
17 of 19 checks passed
@GiovanniCanali GiovanniCanali deleted the pirate_net 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

enhancement New feature or request 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.

Implementation of the PirateNet

4 participants