Closed Savid-mask777 closed 3 years ago
I think you are probably using an old Pytorch version.
According to the Pytorch home page, torch.square()
is available since 1.5 version. You could either try a newer version or simply change that line to:
num = torch.sqrt((y2 - y1)**2 + (x2 - x1)**2 + 1e-14)
or
num = torch.sqrt((y2 - y1)*(y2 - y1) + (x2 - x1)*(x2 - x1) + 1e-14)
File "/home/a/code/box_iou_rotated_diff/min_enclosing_box.py", line 102, in point_line_distance_range num = torch.sqrt((y2 - y1).square() + (x2 - x1).square() + 1e-14) AttributeError: 'Tensor' object has no attribute 'square'