From 1b745772ac2bdac8d9e1dd08115282fc23008a4f Mon Sep 17 00:00:00 2001 From: Prabhat Roy Date: Wed, 20 Oct 2021 10:58:48 +0100 Subject: [PATCH 1/2] Fixed unused variables in ops --- torchvision/ops/boxes.py | 2 +- torchvision/ops/deform_conv.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/torchvision/ops/boxes.py b/torchvision/ops/boxes.py index f8d9c596606..8547383d34b 100644 --- a/torchvision/ops/boxes.py +++ b/torchvision/ops/boxes.py @@ -323,7 +323,7 @@ def masks_to_boxes(masks: torch.Tensor) -> torch.Tensor: bounding_boxes = torch.zeros((n, 4), device=masks.device, dtype=torch.float) for index, mask in enumerate(masks): - y, x = torch.where(masks[index] != 0) + y, x = torch.where(mask != 0) bounding_boxes[index, 0] = torch.min(x) bounding_boxes[index, 1] = torch.min(y) diff --git a/torchvision/ops/deform_conv.py b/torchvision/ops/deform_conv.py index 550f659b07d..9e0f9140285 100644 --- a/torchvision/ops/deform_conv.py +++ b/torchvision/ops/deform_conv.py @@ -74,7 +74,7 @@ def deform_conv2d( pad_h, pad_w = _pair(padding) dil_h, dil_w = _pair(dilation) weights_h, weights_w = weight.shape[-2:] - _, n_in_channels, in_h, in_w = input.shape + _, n_in_channels, *_ = input.shape n_offset_grps = offset.shape[1] // (2 * weights_h * weights_w) n_weight_grps = n_in_channels // weight.shape[1] From 2f753d556a3dbc982d16a3e01c9051b6fd9c8e91 Mon Sep 17 00:00:00 2001 From: Prabhat Roy Date: Wed, 20 Oct 2021 11:37:30 +0100 Subject: [PATCH 2/2] Fixed test failure --- torchvision/ops/deform_conv.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/torchvision/ops/deform_conv.py b/torchvision/ops/deform_conv.py index 9e0f9140285..f898f66f702 100644 --- a/torchvision/ops/deform_conv.py +++ b/torchvision/ops/deform_conv.py @@ -74,7 +74,7 @@ def deform_conv2d( pad_h, pad_w = _pair(padding) dil_h, dil_w = _pair(dilation) weights_h, weights_w = weight.shape[-2:] - _, n_in_channels, *_ = input.shape + _, n_in_channels, _, _ = input.shape n_offset_grps = offset.shape[1] // (2 * weights_h * weights_w) n_weight_grps = n_in_channels // weight.shape[1]