Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: facebookresearch/detectron2
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: main
Choose a base ref
...
head repository: animalife/detectron2
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: main
Choose a head ref
Can’t automatically merge. Don’t worry, you can still create the pull request.
  • 1 commit
  • 1 file changed
  • 1 contributor

Commits on Aug 18, 2022

  1. Copy the full SHA
    e7c3855 View commit details
Showing with 16 additions and 16 deletions.
  1. +16 −16 detectron2/modeling/poolers.py
32 changes: 16 additions & 16 deletions detectron2/modeling/poolers.py
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@

from detectron2.layers import ROIAlign, ROIAlignRotated, cat, nonzero_tuple, shapes_to_tensor
from detectron2.structures import Boxes
from detectron2.utils.tracing import assert_fx_safe
#from detectron2.utils.tracing import assert_fx_safe

"""
To export ROIPooler to torchscript, in this file, variables that should be annotated with
@@ -220,21 +220,21 @@ def forward(self, x: List[torch.Tensor], box_lists: List[Boxes]):
"""
num_level_assignments = len(self.level_poolers)

assert_fx_safe(
isinstance(x, list) and isinstance(box_lists, list), "Arguments to pooler must be lists"
)
assert_fx_safe(
len(x) == num_level_assignments,
"unequal value, num_level_assignments={}, but x is list of {} Tensors".format(
num_level_assignments, len(x)
),
)
assert_fx_safe(
len(box_lists) == x[0].size(0),
"unequal value, x[0] batch dim 0 is {}, but box_list has length {}".format(
x[0].size(0), len(box_lists)
),
)
# assert_fx_safe(
# isinstance(x, list) and isinstance(box_lists, list), "Arguments to pooler must be lists"
# )
# assert_fx_safe(
# len(x) == num_level_assignments,
# "unequal value, num_level_assignments={}, but x is list of {} Tensors".format(
# num_level_assignments, len(x)
# ),
# )
# assert_fx_safe(
# len(box_lists) == x[0].size(0),
# "unequal value, x[0] batch dim 0 is {}, but box_list has length {}".format(
# x[0].size(0), len(box_lists)
# ),
# )
if len(box_lists) == 0:
return _create_zeros(None, x[0].shape[1], *self.output_size, x[0])