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