Skip to content

Commit

Permalink
remove scripting hack for classmethod
Browse files Browse the repository at this point in the history
Summary: require pytorch/pytorch#49967

Reviewed By: theschnitz

Differential Revision: D25852122

fbshipit-source-id: eb2da41f28861fd8ac4f348283bb072abfe8fedd
  • Loading branch information
ppwwyyxx authored and facebook-github-bot committed Jan 11, 2021
1 parent 3e71a27 commit 1db678a
Showing 1 changed file with 0 additions and 8 deletions.
8 changes: 0 additions & 8 deletions detectron2/structures/boxes.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,14 +297,6 @@ def cat(cls, boxes_list: List["Boxes"]) -> "Boxes":
Returns:
Boxes: the concatenated Boxes
"""
if torch.jit.is_scripting():
# https://github.com/pytorch/pytorch/issues/18627
# 1. staticmethod can be used in torchscript, But we can not use
# `type(boxes).staticmethod` because torchscript only supports function
# `type` with input type `torch.Tensor`.
# 2. classmethod is not fully supported by torchscript. We explicitly assign
# cls to Box as a workaround to get torchscript support.
cls = Boxes
assert isinstance(boxes_list, (list, tuple))
if len(boxes_list) == 0:
return cls(torch.empty(0))
Expand Down

0 comments on commit 1db678a

Please sign in to comment.