why is the visual transformer position embedding initializing to zeros #409
Answered
by
rwightman
matthewchung74
asked this question in
General
-
I'm looking at the timm implementation of visual transformers and for the positional embedding, he is initializing his position embedding with zeros
https://github.com/rwightman/pytorch-image-models/blob/master/timm/models/vision_transformer.py#L309 I'm not sure how this actually embeds anything about the position when it is later added to the patch?
any feedback is appreciated. |
Beta Was this translation helpful? Give feedback.
Answered by
rwightman
Feb 4, 2021
Replies: 1 comment 3 replies
-
@matthewchung74 it's actually init to |
Beta Was this translation helpful? Give feedback.
3 replies
Answer selected by
matthewchung74
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@matthewchung74 it's actually init to
trunc_normal_(self.pos_embed, std=.02)
... the zeros was just for defining the param but could have done it differently