Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correcting incorrect types #3

Merged
merged 1 commit into from
Nov 27, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 20 additions & 6 deletions models/anchor_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,13 @@ def __init__(
self.strides = strides
self.anchor_grids = anchor_grids

def set_wh_weights(self, grid_sizes, dtype, device):
# type: (List[List[int]], int, Device) -> Tensor # noqa: F821
def set_wh_weights(
self,
grid_sizes: List[List[int]],
dtype: torch.dtype = torch.float32,
device: torch.device = torch.device("cpu"),
) -> Tensor:

wh_weights = []

for size, stride in zip(grid_sizes, self.strides):
Expand All @@ -31,8 +36,13 @@ def set_wh_weights(self, grid_sizes, dtype, device):

return torch.cat(wh_weights)

def set_xy_weights(self, grid_sizes, dtype, device):
# type: (List[List[int]], int, Device) -> Tensor # noqa: F821
def set_xy_weights(
self,
grid_sizes: List[List[int]],
dtype: torch.dtype = torch.float32,
device: torch.device = torch.device("cpu"),
) -> Tensor:

xy_weights = []

for size, anchor_grid in zip(grid_sizes, self.anchor_grids):
Expand All @@ -45,8 +55,12 @@ def set_xy_weights(self, grid_sizes, dtype, device):

return torch.cat(xy_weights)

def grid_anchors(self, grid_sizes, device):
# type: (List[List[int]], Device) -> Tensor # noqa: F821
def grid_anchors(
self,
grid_sizes: List[List[int]],
device: torch.device = torch.device("cpu"),
) -> Tensor:

anchors = []

for size in grid_sizes:
Expand Down