Possible fix for exploding object size#1322
Open
sebffischer wants to merge 3 commits intomlverse:mainfrom
Open
Possible fix for exploding object size#1322sebffischer wants to merge 3 commits intomlverse:mainfrom
sebffischer wants to merge 3 commits intomlverse:mainfrom
Conversation
dfalbel
reviewed
May 28, 2025
Member
dfalbel
left a comment
There was a problem hiding this comment.
Looks reasonable, although I do think we should not recommend people to define modules within modules. It's better to define them in top level environments. In the worst case scenario its always possible to create a generic module that takes a closure to initialize parameters a a forwardclosure. Eg:
nn_generic_module <- nn_mopdule(
inititialize = function(init, fwd) {
self$fwd <- fwd
self$pars <- lapply(init(), nn_parameter)
},
forward = function(x) {
self$fwd(pars, x)
}
)
dfalbel
reviewed
May 28, 2025
| NULL | ||
|
|
||
| default_parent_env = function() { | ||
| env = parent.frame(2) |
Member
There was a problem hiding this comment.
Mayvbve add a comment about the 2 here
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I am not yet sure whether this has any negative consequences that are problematic.
What do you think about this approach?
If this is a desirable solution to #1320 then I would still need to add more tests.
Also, I think a more robust way to access the
inheritclass is required.Created on 2025-05-28 with reprex v2.1.1