Annotate dunder functions

Summary: Annotate the (return type of the) following dunder functions across the codebase: `__init__()`, `__len__()`, `__getitem__()`

Reviewed By: nikhilaravi

Differential Revision: D29001801

fbshipit-source-id: 928d9e1c417ffe01ab8c0445311287786e997c7c
This commit is contained in:
Patrick Labatut
2021-06-24 15:18:19 -07:00
committed by Facebook GitHub Bot
parent 35855bf860
commit 64289a491d
35 changed files with 79 additions and 79 deletions

View File

@@ -25,7 +25,7 @@ class TensorAccessor(nn.Module):
and one element in the batch needs to be modified.
"""
def __init__(self, class_object, index: Union[int, slice]):
def __init__(self, class_object, index: Union[int, slice]) -> None:
"""
Args:
class_object: this should be an instance of a class which has
@@ -96,7 +96,7 @@ class TensorProperties(nn.Module):
def __init__(
self, dtype: torch.dtype = torch.float32, device: Device = "cpu", **kwargs
):
) -> None:
"""
Args:
dtype: data type to set for the inputs
@@ -143,7 +143,7 @@ class TensorProperties(nn.Module):
def isempty(self) -> bool:
return self._N == 0
def __getitem__(self, index: Union[int, slice]):
def __getitem__(self, index: Union[int, slice]) -> TensorAccessor:
"""
Args: