Skip to content

Commit

Permalink
bias incorrect
Browse files Browse the repository at this point in the history
  • Loading branch information
fffffgggg54 committed Dec 29, 2024
1 parent 86c1104 commit d6bb62f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion timm/layers/ml_decoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,9 +327,10 @@ def __init__(
# 1 group for all queries (shared_fc, use with class_embed) or 1 group for each query (default, used in paper)
self.num_classes = num_classes
duplicate_factor = int(num_classes / num_groups + 0.999)
num_biases = duplicate_factor if shared else num_classes
num_groups = 1 if shared else num_groups
self.weight = nn.Parameter(torch.Tensor(num_groups, dim, duplicate_factor))
self.bias = nn.Parameter(torch.Tensor(self.num_classes))
self.bias = nn.Parameter(torch.Tensor(num_biases))
nn.init.xavier_normal_(self.weight)
nn.init.constant_(self.bias, 0)

Expand Down

0 comments on commit d6bb62f

Please sign in to comment.