-
Notifications
You must be signed in to change notification settings - Fork 755
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
[Feature] Add svtr encoder #1483
Conversation
aadaafd
to
e967aa2
Compare
e967aa2
to
a45f11e
Compare
def __init__(self, | ||
embed_dims: int, | ||
num_heads: int = 8, | ||
mixer: str = 'Global', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
global / local
global is never used, and the parameter can be changed to whether_local
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's okay to keep the name consistent with paper
self.apply(self._init_weights) | ||
|
||
def _init_weights(self, m): | ||
if isinstance(m, nn.Linear): | ||
trunc_normal_init(m.weight, mean=0, std=0.02) | ||
if isinstance(m, nn.Linear) and m.bias is not None: | ||
nn.init.zeros_(m.bias) | ||
if isinstance(m, nn.LayerNorm): | ||
nn.init.zeros_(m.bias) | ||
nn.init.ones_(m.weight) | ||
if isinstance(m, nn.Conv2d): | ||
nn.init.kaiming_normal_( | ||
m.weight, mode='fan_out', nonlinearity='relu') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove and init with init_cfg
Thanks for your contribution and we appreciate it a lot. The following instructions would make your pull request more healthy and more easily get feedback. If you do not understand some items, don't worry, just make the pull request and seek help from maintainers.
Motivation
Please describe the motivation of this PR and the goal you want to achieve through this PR.
Modification
Please briefly describe what modification is made in this PR.
BC-breaking (Optional)
Does the modification introduce changes that break the backward-compatibility of the downstream repositories?
If so, please describe how it breaks the compatibility and how the downstream projects should modify their code to keep compatibility with this PR.
Use cases (Optional)
If this PR introduces a new feature, it is better to list some use cases here, and update the documentation.
Checklist
Before PR:
After PR: