Unverified Commit 5dd08427 authored by Shoufa Chen's avatar Shoufa Chen Committed by GitHub
Browse files

[Enhancement]: Fix torch.nonzero warning (#4805)

similar warning: https://github.com/open-mmlab/mmdetection/pull/2602
parent 58bf7da7
......@@ -264,9 +264,10 @@ class YOLACTHead(AnchorHead):
loss_cls_all = self.loss_cls(cls_score, labels, label_weights)
# FG cat_id: [0, num_classes -1], BG cat_id: num_classes
pos_inds = ((labels >= 0) &
(labels < self.num_classes)).nonzero().reshape(-1)
neg_inds = (labels == self.num_classes).nonzero().view(-1)
pos_inds = ((labels >= 0) & (labels < self.num_classes)).nonzero(
as_tuple=False).reshape(-1)
neg_inds = (labels == self.num_classes).nonzero(
as_tuple=False).view(-1)
num_pos_samples = pos_inds.size(0)
if num_pos_samples == 0:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment