mirror of
https://github.com/THU-MIG/yolov10.git
synced 2025-05-24 06:14:55 +08:00
[RTDETR]fix "Grad strides do not match bucket view strides" when training with DDP (#3255)
This commit is contained in:
parent
58bccb1a9f
commit
eda7758521
@ -77,7 +77,7 @@ class AIFI(TransformerEncoderLayer):
|
|||||||
pos_embed = self.build_2d_sincos_position_embedding(w, h, c)
|
pos_embed = self.build_2d_sincos_position_embedding(w, h, c)
|
||||||
# flatten [B, C, H, W] to [B, HxW, C]
|
# flatten [B, C, H, W] to [B, HxW, C]
|
||||||
x = super().forward(x.flatten(2).permute(0, 2, 1), pos=pos_embed.to(device=x.device, dtype=x.dtype))
|
x = super().forward(x.flatten(2).permute(0, 2, 1), pos=pos_embed.to(device=x.device, dtype=x.dtype))
|
||||||
return x.permute((0, 2, 1)).view([-1, c, h, w])
|
return x.permute(0, 2, 1).view([-1, c, h, w]).contiguous()
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def build_2d_sincos_position_embedding(w, h, embed_dim=256, temperature=10000.):
|
def build_2d_sincos_position_embedding(w, h, embed_dim=256, temperature=10000.):
|
||||||
|
@ -31,9 +31,6 @@ class HungarianMatcher(nn.Module):
|
|||||||
_cost_mask(bs, num_gts, masks=None, gt_mask=None): Computes the mask cost and dice cost if masks are predicted.
|
_cost_mask(bs, num_gts, masks=None, gt_mask=None): Computes the mask cost and dice cost if masks are predicted.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
class HungarianMatcher(nn.Module):
|
|
||||||
...
|
|
||||||
|
|
||||||
def __init__(self, cost_gain=None, use_fl=True, with_mask=False, num_sample_points=12544, alpha=0.25, gamma=2.0):
|
def __init__(self, cost_gain=None, use_fl=True, with_mask=False, num_sample_points=12544, alpha=0.25, gamma=2.0):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
if cost_gain is None:
|
if cost_gain is None:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user