Unverified Commit 8e611cfd authored by Mike Ruberry's avatar Mike Ruberry Committed by GitHub
Browse files

Updates integer division to use floor division operator (#2234)

Integer division using the div operator is deprecated and will throw a RuntimeError in PyTorch 1.6 (and on PyTorch Master very soon). Running a test build with a recent Torchvision commit and integer division using div ('/') disabled revealed this integer division. 

I'll re-run the tests once this is fixed in case it's masking additional issues.
parent d74404ad
...@@ -160,8 +160,8 @@ class AnchorGenerator(nn.Module): ...@@ -160,8 +160,8 @@ class AnchorGenerator(nn.Module):
grid_sizes = list([feature_map.shape[-2:] for feature_map in feature_maps]) grid_sizes = list([feature_map.shape[-2:] for feature_map in feature_maps])
image_size = image_list.tensors.shape[-2:] image_size = image_list.tensors.shape[-2:]
dtype, device = feature_maps[0].dtype, feature_maps[0].device dtype, device = feature_maps[0].dtype, feature_maps[0].device
strides = [[torch.tensor(image_size[0] / g[0], dtype=torch.int64, device=device), strides = [[torch.tensor(image_size[0] // g[0], dtype=torch.int64, device=device),
torch.tensor(image_size[1] / g[1], dtype=torch.int64, device=device)] for g in grid_sizes] torch.tensor(image_size[1] // g[1], dtype=torch.int64, device=device)] for g in grid_sizes]
self.set_cell_anchors(dtype, device) self.set_cell_anchors(dtype, device)
anchors_over_all_feature_maps = self.cached_grid_anchors(grid_sizes, strides) anchors_over_all_feature_maps = self.cached_grid_anchors(grid_sizes, strides)
anchors = torch.jit.annotate(List[List[torch.Tensor]], []) anchors = torch.jit.annotate(List[List[torch.Tensor]], [])
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment