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

Default fied_heads with instances will cause shared parameters #2197

Merged
merged 4 commits into from
Jul 11, 2023

Conversation

hyperzy
Copy link
Contributor

@hyperzy hyperzy commented Jul 11, 2023

Parameters default to an instantiated object would remain the same according to Python doc

Default parameter values are evaluated from left to right when the function definition is executed. This means that the expression is evaluated once, when the function is defined, and that the same “pre-computed” value is used for each call. This is especially important to understand when a default parameter is a mutable object, such as a list or a dictionary: if the function modifies the object (e.g. by appending an item to a list), the default value is in effect modified....

Therefore, the coarse_field and fine_field would share the same RGBFieldHead, which is not the expected behavior.

@tancik tancik enabled auto-merge (squash) July 11, 2023 15:50
@tancik tancik merged commit e9a5a66 into nerfstudio-project:main Jul 11, 2023
4 checks passed
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