@@ -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" ]
385385exclude_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]
388398command = [
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]
0 commit comments