Initialize the transformer weights.
(self)
| 392 | self.reference_points = nn.Linear(self.embed_dims, 2) |
| 393 | |
| 394 | def init_weights(self): |
| 395 | """Initialize the transformer weights.""" |
| 396 | for p in self.parameters(): |
| 397 | if p.dim() > 1: |
| 398 | nn.init.xavier_uniform_(p) |
| 399 | for m in self.modules(): |
| 400 | if isinstance(m, MultiScaleDeformableAttention): |
| 401 | m.init_weights() |
| 402 | if not self.as_two_stage: |
| 403 | xavier_init(self.reference_points, distribution='uniform', bias=0.) |
| 404 | normal_(self.level_embeds) |
| 405 | |
| 406 | def gen_encoder_output_proposals(self, memory, memory_padding_mask, |
| 407 | spatial_shapes): |
nothing calls this directly
no test coverage detected