Skip to content

Commit a11f400

Browse files
committed
up
1 parent 8377245 commit a11f400

File tree

2 files changed

+25
-18
lines changed

2 files changed

+25
-18
lines changed

.lintrunner.toml

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -380,24 +380,31 @@ command = [
380380
]
381381

382382
[[linter]]
383-
code = 'TORCH_AO_IMPORT'
384-
include_patterns = ['**/*.py']
383+
code = "TORCH_AO_IMPORT"
384+
include_patterns = ["**/*.py"]
385385
exclude_patterns = [
386-
'third-party/**',
386+
"third-party/**",
387+
# Some existing files have imports from torch.ao.quantization that are not going away, e.g.,
388+
# from torch.ao.quantization.fx.utils, from torch.ao.quantization.qconfig, etc.
389+
"backends/xnnpack/test/test_xnnpack_utils.py",
390+
"exir/backend/test/demos/test_xnnpack_qnnpack.py",
391+
"backends/xnnpack/quantizer/xnnpack_quantizer_utils.py",
392+
"backends/xnnpack/test/quantizer/test_pt2e_quantization.py",
393+
"backends/xnnpack/test/quantizer/test_xnnpack_quantizer.py",
394+
"examples/xnnpack/quantization/example.py",
395+
"exir/tests/test_quantization.py",
396+
"exir/tests/test_memory_planning.py",
387397
]
388398
command = [
389-
'python3',
390-
'-m',
391-
'lintrunner_adapters',
392-
'run',
393-
'grep_linter',
394-
'--pattern=\\bfrom torch.ao.quantization(\\.[a-zA-Z0-9_]+)*\\b',
395-
'--linter-name=TorchAOImport',
396-
'--error-name=Prohibited torch.ao.quantization import',
397-
"""--error-description=\
398-
Imports from torch.ao.quantization are not allowed. \
399-
Please import from torchao.quantization.pt2e instead.\
400-
""",
401-
'--',
402-
'@{{PATHSFILE}}',
399+
"python3",
400+
"-m",
401+
"lintrunner_adapters",
402+
"run",
403+
"grep_linter",
404+
"--pattern=\\bfrom torch\\.ao\\.quantization(?:\\.[A-Za-z0-9_]+)*\\b",
405+
"--linter-name=TorchAOImport",
406+
"--error-name=Prohibited torch.ao.quantization import",
407+
"--error-description=Imports from torch.ao.quantization are not allowed. Please import from torchao.quantization.pt2e instead.",
408+
"--",
409+
"@{{PATHSFILE}}",
403410
]

backends/xnnpack/test/quantizer/test_xnnpack_quantizer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
convert_to_reference_fx,
2323
prepare_fx,
2424
)
25-
from torch.ao.quantization.quantize_pt2e import convert_pt2e, prepare_pt2e
2625
from torch.export import export_for_training
2726
from torch.testing._internal.common_quantization import (
2827
NodeSpec as ns,
@@ -34,6 +33,7 @@
3433
from torch.testing._internal.common_quantized import override_quantized_engine
3534
from torchao.quantization.pt2e import observer
3635
from torchao.quantization.pt2e.fake_quantize import default_dynamic_fake_quant
36+
from torchao.quantization.pt2e.quantize_pt2e import convert_pt2e, prepare_pt2e
3737

3838

3939
@skipIfNoQNNPACK

0 commit comments

Comments
 (0)