Skip to content

Commit

Permalink
Add TorchFix linter (pytorch#298)
Browse files Browse the repository at this point in the history
Summary:
Besides adding to the CI, updated exir/emit/test/test_emit.py to fix TOR101 "Use of deprecated function torch.nn.UpsamplingNearest2d"

Lint error "Advice (FLAKE8) C901 'PermuteMemoryFormatsPass.call' is too complex (13)" is pre-existing.

Pull Request resolved: pytorch#298

Reviewed By: huydhn

Differential Revision: D49216427

Pulled By: kit1980

fbshipit-source-id: f45d16e1d83caef00757efb9d66a04b048bc5dc6
  • Loading branch information
kit1980 authored and facebook-github-bot committed Sep 14, 2023
1 parent e697d21 commit 31aaa12
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 6 deletions.
1 change: 1 addition & 0 deletions .ci/docker/requirements-lintrunner.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ flake8-comprehensions==3.12.0
flake8-pyi==23.5.0
mccabe==0.7.0
pycodestyle==2.10.0
torchfix==0.0.2

# UFMT
black==22.12.0
Expand Down
2 changes: 1 addition & 1 deletion .flake8
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[flake8]
select = B,C,E,F,P,W,B9
select = B,C,E,F,P,W,B9,TOR0,TOR1,TOR2
max-line-length = 80
ignore =
# Black conflicts and overlaps.
Expand Down
6 changes: 1 addition & 5 deletions exir/emit/test/test_emit.py
Original file line number Diff line number Diff line change
Expand Up @@ -635,12 +635,8 @@ def f(x: torch.Tensor) -> torch.Tensor:

def test_optional_float_list(self) -> None:
class M(torch.nn.Module):
def __init__(self):
super().__init__()
self.upsample = torch.nn.UpsamplingNearest2d(scale_factor=2)

def forward(self, x):
return self.upsample(x)
return torch.nn.functional.interpolate(x, scale_factor=2)

x = (torch.randn(1, 1, 2, 2),)
program = (
Expand Down

0 comments on commit 31aaa12

Please sign in to comment.