Skip to content

Commit 31aaa12

Browse files
kit1980facebook-github-bot
authored andcommitted
Add TorchFix linter (#298)
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: #298 Reviewed By: huydhn Differential Revision: D49216427 Pulled By: kit1980 fbshipit-source-id: f45d16e1d83caef00757efb9d66a04b048bc5dc6
1 parent e697d21 commit 31aaa12

File tree

3 files changed

+3
-6
lines changed

3 files changed

+3
-6
lines changed

.ci/docker/requirements-lintrunner.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ flake8-comprehensions==3.12.0
1010
flake8-pyi==23.5.0
1111
mccabe==0.7.0
1212
pycodestyle==2.10.0
13+
torchfix==0.0.2
1314

1415
# UFMT
1516
black==22.12.0

.flake8

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[flake8]
2-
select = B,C,E,F,P,W,B9
2+
select = B,C,E,F,P,W,B9,TOR0,TOR1,TOR2
33
max-line-length = 80
44
ignore =
55
# Black conflicts and overlaps.

exir/emit/test/test_emit.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -635,12 +635,8 @@ def f(x: torch.Tensor) -> torch.Tensor:
635635

636636
def test_optional_float_list(self) -> None:
637637
class M(torch.nn.Module):
638-
def __init__(self):
639-
super().__init__()
640-
self.upsample = torch.nn.UpsamplingNearest2d(scale_factor=2)
641-
642638
def forward(self, x):
643-
return self.upsample(x)
639+
return torch.nn.functional.interpolate(x, scale_factor=2)
644640

645641
x = (torch.randn(1, 1, 2, 2),)
646642
program = (

0 commit comments

Comments
 (0)