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

Add user-friendly module copy method. #3461

Merged
merged 1 commit into from
Nov 6, 2023

Conversation

levskaya
Copy link
Collaborator

@levskaya levskaya commented Nov 4, 2023

This provides a version of the Module.clone() method with simpler arguments and better defaults for allowing copying of modules and the use of existing modules as "templates". By default copy resets parent and name attributes of the given module, but effectively performs a deep copy of everything "inside".

@codecov-commenter
Copy link

codecov-commenter commented Nov 4, 2023

Codecov Report

Merging #3461 (40e2b93) into main (055e28f) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main    #3461   +/-   ##
=======================================
  Coverage   83.56%   83.57%           
=======================================
  Files          56       56           
  Lines        6768     6770    +2     
=======================================
+ Hits         5656     5658    +2     
  Misses       1112     1112           
Files Coverage Δ
flax/linen/module.py 92.05% <100.00%> (+0.02%) ⬆️

Copy link
Collaborator

@cgarciae cgarciae left a comment

Choose a reason for hiding this comment

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

looks good!

@copybara-service copybara-service bot merged commit 85245ad into google:main Nov 6, 2023
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants