mirror of
https://github.com/tinygrad/tinygrad.git
synced 2026-04-29 03:00:14 -04:00
realize boxcoder's encoding
This commit is contained in:
@@ -176,7 +176,7 @@ class RegressionHead:
|
||||
|
||||
def _compute_loss(self, x:Tensor, bboxes:Tensor, matches:Tensor, anchors:Tensor) -> Tensor:
|
||||
mask = (fg_idxs := matches >= 0).reshape(matches.shape[0], -1, 1)
|
||||
tgt = self.box_coder.encode(bboxes, anchors)
|
||||
tgt = self.box_coder.encode(bboxes, anchors).realize()
|
||||
loss = mask.where(l1_loss(x, tgt), 0).sum(-1).sum(-1)
|
||||
loss = (loss / fg_idxs.sum(-1)).sum() / matches.shape[0]
|
||||
return loss
|
||||
|
||||
Reference in New Issue
Block a user