Commit 2f0e1c92 authored by Steven Troxler's avatar Steven Troxler Committed by Facebook GitHub Bot
Browse files

fbcode/mobile-vision

Summary:
Convert type comments in fbcode/mobile-vision

Produced by running:
```
python -m  libcst.tool codemod convert_type_comments.ConvertTypeComment fbcode/mobile-vision
```
from fbsource.

See
https://fb.workplace.com/groups/pythonfoundation/permalink/3106231549690303/

Reviewed By: grievejia

Differential Revision: D33897026

fbshipit-source-id: e7666555e47a9abc769975f6db6b2e6eda792d72
parent a1b1bf94
......@@ -297,8 +297,7 @@ def collate_fn(batch):
return tuple(batch)
def _max_by_axis(the_list):
# type: (List[List[int]]) -> List[int]
def _max_by_axis(the_list: "List[List[int]]") -> "List[int]":
maxes = the_list[0]
for sublist in the_list[1:]:
for index, item in enumerate(sublist):
......@@ -311,8 +310,7 @@ class NestedTensor(object):
self.tensors = tensors
self.mask = mask
def to(self, device):
# type: (Device) -> NestedTensor # noqa
def to(self, device: torch.device) -> "NestedTensor":
cast_tensor = self.tensors.to(device)
mask = self.mask
if mask is not None:
......@@ -486,9 +484,12 @@ def accuracy(output, target, topk=(1,)):
def interpolate(
input, size=None, scale_factor=None, mode="nearest", align_corners=None
):
# type: (Tensor, Optional[List[int]], Optional[float], str, Optional[bool]) -> Tensor
input: "Tensor",
size: "Optional[List[int]]" = None,
scale_factor: "Optional[float]" = None,
mode: str = "nearest",
align_corners: "Optional[bool]" = None,
) -> "Tensor":
"""
Equivalent to nn.functional.interpolate, but with support for empty batch sizes.
This will eventually be supported natively by PyTorch, and this
......
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