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 more detail of warning in basemodule #899

Merged
merged 1 commit into from
Mar 29, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions mmcv/runner/base_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ def init_weight(self):
module.init_weight()
self._is_init = True
else:
warnings.warn('This module has bee initialized, \
please call initialize(module, init_cfg) to reinitialize it')
warnings.warn(f'init_weight of {self.__class__.__name__} has '
f'been called more than once.')
Copy link
Collaborator

Choose a reason for hiding this comment

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

Agree, but "please call initialize(module, init_cfg) to reinitialize it" should be kept to give a tip for users what they could do.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Actually, I am confused about why we should reinitialize it?

Copy link
Collaborator

Choose a reason for hiding this comment

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

It should not be initialized again, so I leave a warning as a reminder.

Copy link
Collaborator Author

@jshilong jshilong Mar 23, 2021

Choose a reason for hiding this comment

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

What does please call initialize(module, init_cfg) to reinitialize it mean?


def __repr__(self):
s = super().__repr__()
Expand Down