Skip to content

Commit 9ba7824

Browse files
author
Alexandre Mayerowitz
committed
Replace .view() with .reshape() for anchors formatting
1 parent 9cb4318 commit 9ba7824

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

effdet/anchors.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -353,8 +353,8 @@ def label_anchors(self, gt_boxes, gt_classes, filter_valid=True):
353353
for level in range(self.anchors.min_level, self.anchors.max_level + 1):
354354
feat_size = self.anchors.feat_sizes[level]
355355
steps = feat_size[0] * feat_size[1] * self.anchors.get_anchors_per_location()
356-
cls_targets_out.append(cls_targets[count:count + steps].view([feat_size[0], feat_size[1], -1]))
357-
box_targets_out.append(box_targets[count:count + steps].view([feat_size[0], feat_size[1], -1]))
356+
cls_targets_out.append(cls_targets[count:count + steps].reshape([feat_size[0], feat_size[1], -1]))
357+
box_targets_out.append(box_targets[count:count + steps].reshape([feat_size[0], feat_size[1], -1]))
358358
count += steps
359359

360360
num_positives = (matches.match_results > -1).float().sum()
@@ -393,9 +393,9 @@ def batch_label_anchors(self, gt_boxes, gt_classes, filter_valid=True):
393393
feat_size = self.anchors.feat_sizes[level]
394394
steps = feat_size[0] * feat_size[1] * self.anchors.get_anchors_per_location()
395395
cls_targets_out[level_idx].append(
396-
cls_targets[count:count + steps].view([feat_size[0], feat_size[1], -1]))
396+
cls_targets[count:count + steps].reshape([feat_size[0], feat_size[1], -1]))
397397
box_targets_out[level_idx].append(
398-
box_targets[count:count + steps].view([feat_size[0], feat_size[1], -1]))
398+
box_targets[count:count + steps].reshape([feat_size[0], feat_size[1], -1]))
399399
count += steps
400400
if last_sample:
401401
cls_targets_out[level_idx] = torch.stack(cls_targets_out[level_idx])

0 commit comments

Comments
 (0)