Skip to content

Commit

Permalink
Type annotate dataloader2 train loop (#664)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #664

* Type annotate dataloader2 train loop

Reviewed By: Miiira

Differential Revision: D37971478

fbshipit-source-id: 67cdd33fce70b43da4f9782f277510d1d7cfc7a1
  • Loading branch information
dahsh authored and facebook-github-bot committed Jul 20, 2022
1 parent c2223fd commit b6ecce0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions examples/dataloader2/train_loop.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@


class ToyModel(torch.nn.Module):
def __init__(self):
def __init__(self) -> None:
"""
In the model constructor, we instantiate four parameters and use them
as member parameters.
Expand All @@ -22,7 +22,7 @@ def __init__(self):
self.c = torch.nn.Parameter(torch.randn(()))
self.d = torch.nn.Parameter(torch.randn(()))

def forward(self, x):
def forward(self, x: torch.Tensor) -> torch.Tensor:
"""
Simple model forward function
"""
Expand Down

0 comments on commit b6ecce0

Please sign in to comment.