# [[linter]]
# code = 'FLAKE8'
# include_patterns = ['**/*.py']
# exclude_patterns = [
# '.git/**',
# 'build_test_custom_build/**',
# 'build/**',
# 'caffe2/**',
# 'docs/caffe2/**',
# 'docs/cpp/src/**',
# 'docs/src/**',
# 'fb/**',
# '**/fb/**',
# 'functorch/docs/**',
# 'functorch/examples/**',
# 'functorch/docs/source/tutorials/**',
# 'torch_npu/_inductor/fx_passes/serialized_patterns/**',
# 'torch_npu/_inductor/autoheuristic/artifacts/**',
# 'torch_npu/_inductor/kernel/vendored_templates/cutedsl/kernels/**',
# 'torch_npu/_inductor/kernel/vendored_templates/cutedsl/dense_blockscaled_gemm_persistent.py',
# 'scripts/**',
# 'test/generated_type_hints_smoketest.py',
# 'test/test_torchfuzz_repros.py',
# # CPython tests
# 'test/dynamo/cpython/**',
# # Tests from the NumPy test suite
# 'test/torch_np/numpy_test/**/*.py',
# 'test/npu/test_fault_mode.py',
# 'torch_npu/utils/_dynamo.py',
# 'test/npu/test_resnet.py',
# 'test/npu/test_public_bindings.py',
# 'test/npu/test_compatibility.py',
# # Skip all tests for NPUGraph
# 'third_party/**',
# 'torch_npu/include/**',
# 'torch_npu/lib/**',
# # NPUGraph logs files
# 'torch_npu/_logging/_internal.py',
# 'torch_npu/csrc/core/npu/NPUGraph.cpp',
# 'torch_npu/csrc/core/npu/NPUGraph.h',
# 'torch_npu/csrc/npu/Graph.cpp',
# 'torch_npu/npu/_graph_tree.py',
# 'torch_npu/npu/graphs.py',
# 'torch_npu/utils/_graph_tree.py',
# 'torch/include/**',
# 'torch/lib/**',
# 'venv/**',
# '**/*.pyi',
# "tools/experimental/torchfuzz/**",
# 'tools/test/test_selective_build.py',
# ]
# command = [
# 'uv',
# 'run',
# '--script',
# 'tools/linter/adapters/flake8_linter.py',
# '--',
# '@{{PATHSFILE}}'
# ]
# [[linter]]
# code = 'CLANGFORMAT'
# include_patterns = [
# 'aten/src/ATen/*.h',
# 'aten/src/ATen/cpu/vec/**/*.h',
# 'aten/src/ATen/accelerator/**/*.h',
# 'aten/src/ATen/accelerator/**/*.cpp',
# 'aten/src/ATen/mps/**/*.mm',
# 'aten/src/ATen/mps/**/*.h',
# 'aten/src/ATen/xpu/**/*.h',
# 'aten/src/ATen/xpu/**/*.cpp',
# 'aten/src/ATen/core/boxing/**/*.h',
# 'aten/src/ATen/core/dispatch/**/*.h',
# 'aten/src/ATen/core/Formatting.cpp',
# 'aten/src/ATen/native/mps/**/*.metal',
# 'aten/src/ATen/native/mps/**/*.mm',
# 'aten/src/ATen/native/mps/**/*.h',
# 'aten/src/ATen/native/vulkan/**/*.h',
# 'aten/src/ATen/native/vulkan/**/*.cpp',
# 'aten/src/ATen/native/cuda/MultiTensorApply.cuh',
# 'aten/src/ATen/native/**/Foreach*.*',
# 'aten/src/ATen/native/cuda/fused*.*',
# 'aten/src/ATen/native/cuda/Fused*.cu',
# 'aten/src/ATen/native/cudnn/*.h',
# 'aten/src/ATen/native/cudnn/*.cpp',
# 'aten/src/ATen/native/mkldnn/xpu/**/*.h',
# 'aten/src/ATen/native/mkldnn/xpu/**/*.cpp',
# 'aten/src/ATen/native/Tensor*.h',
# 'aten/src/ATen/native/Tensor*.cpp',
# 'c10/**/*.h',
# 'c10/**/*.cpp',
# 'torch_npu/csrc/**/*.h',
# 'torch_npu/csrc/**/*.hpp',
# 'torch_npu/csrc/**/*.cpp',
# 'torch_npu/nativert/**/*.h',
# 'torch_npu/nativert/**/*.cpp',
# 'torch_npu/headeronly/**/*.h',
# 'test/cpp/**/*.h',
# 'test/cpp/**/*.cpp',
# ]
# exclude_patterns = [
# 'aten/src/ATen/native/vulkan/api/vk_mem_alloc.h',
# 'aten/src/ATen/native/mps/kernels/Quantized.metal',
# 'c10/util/strong_type.h',
# '**/fb/**',
# 'torch_npu/csrc/inductor/aoti_torch/generated/**',
# 'torch_npu/csrc/jit/serialization/mobile_bytecode_generated.h',
# 'torch_npu/csrc/utils/pythoncapi_compat.h',
# 'torch_npu/csrc/core/npu/NPUCachingAllocator.cpp',
# 'torch_npu/csrc/core/npu/NPUWorkspaceAllocator.cpp',
# 'aten/src/ATen/dlpack.h',
# ]
# init_command = [
# 'python3',
# 'tools/linter/adapters/s3_init.py',
# '--config-json=tools/linter/adapters/s3_init_config.json',
# '--linter=clang-format',
# '--dry-run={{DRYRUN}}',
# '--output-dir=.lintbin',
# '--output-name=clang-format',
# ]
# command = [
# 'python3',
# 'tools/linter/adapters/clangformat_linter.py',
# '--binary=.lintbin/clang-format',
# '--',
# '@{{PATHSFILE}}'
# ]
# is_formatter = true
# [[linter]]
# code = 'PYREFLY'
# include_patterns = [
# 'torch_npu/**/*.py',
# 'torch_npu/**/*.pyi',
# 'torchgen/**/*.py',
# 'torchgen/**/*.pyi',
# 'functorch/**/*.py',
# 'functorch/**/*.pyi',
# 'tools/**/*.py',
# 'tools/**/*.pyi',
# ]
# exclude_patterns = [
# 'torch_npu/_inductor/kernel/vendored_templates/cutedsl/kernels/**',
# 'torch_npu/_inductor/kernel/vendored_templates/cutedsl/dense_blockscaled_gemm_persistent.py',
# 'tools/linter/**',
# 'tools/setup_helpers/**',
# ]
# command = [
# 'uv',
# 'run',
# '--script',
# 'tools/linter/adapters/pyrefly_linter.py',
# '--config=pyrefly.toml',
# ]
# [[linter]]
# code = 'CLANGTIDY'
# include_patterns = [
# # Enable coverage of headers in aten/src/ATen
# # and excluding most sub-directories for now.
# 'aten/src/ATen/*.h',
# 'aten/src/ATen/*.cpp',
# 'aten/src/ATen/cuda/*.cpp',
# 'aten/src/ATen/cpu/*.h',
# 'aten/src/ATen/cpu/*.cpp',
# 'aten/src/ATen/accelerator/**/*.h',
# 'aten/src/ATen/accelerator/**/*.cpp',
# 'aten/src/ATen/core/*.h',
# 'aten/src/ATen/core/*.cpp',
# 'aten/src/ATen/cudnn/*.h',
# 'aten/src/ATen/cudnn/*.cpp',
# 'aten/src/ATen/native/mkldnn/xpu/**/*.h',
# 'aten/src/ATen/native/mkldnn/xpu/**/*.cpp',
# 'aten/src/ATen/detail/*',
# 'aten/src/ATen/functorch/*.h',
# 'aten/src/ATen/functorch/*.cpp',
# 'aten/src/ATen/native/nested/cuda/*.cpp',
# 'aten/src/ATen/native/nested/cuda/*.h',
# 'aten/src/ATen/native/nested/*.cpp',
# 'aten/src/ATen/native/nested/*.h',
# 'aten/src/ATen/xpu/**/*.h',
# 'aten/src/ATen/xpu/**/*.cpp',
# 'c10/**/*.cpp',
# 'c10/**/*.h',
# 'torch_npu/*.h',
# 'torch_npu/_inductor/codegen/aoti_runtime/*.h',
# 'torch_npu/_inductor/codegen/aoti_runtime/*.cpp',
# 'torch_npu/csrc/*.h',
# 'torch_npu/csrc/*.cpp',
# 'torch_npu/csrc/**/*.h',
# 'torch_npu/csrc/**/*.cpp',
# 'torch_npu/csrc/jit/serialization/*.h',
# 'torch_npu/csrc/jit/serialization/*.cpp',
# 'torch_npu/nativert/*.h',
# 'torch_npu/nativert/*.cpp',
# 'torch_npu/nativert/**/*.h',
# 'torch_npu/nativert/**/*.cpp',
# 'torch_npu/headeronly/**/*.h',
# ]
# exclude_patterns = [
# # The negative filters below are to exclude files that include onnx_pb.h or
# # caffe2_pb.h, otherwise we'd have to build protos as part of this CI job.
# # CUDA files are also excluded.
# '**/fb/**',
# '**/generated/**',
# '**/*pb.h',
# '**/*inl.h',
# 'aten/src/ATen/cpu/FlushDenormal.cpp',
# 'aten/src/ATen/cpu/vml.h',
# 'aten/src/ATen/CPUFixedAllocator.h',
# 'aten/src/ATen/Parallel*.h',
# 'c10/xpu/**/*.h',
# 'c10/xpu/**/*.cpp',
# 'c10/benchmark/intrusive_ptr_benchmark.cpp',
# 'c10/cuda/CUDAAlgorithm.h',
# 'c10/util/complex_math.h',
# 'c10/util/complex_utils.h',
# 'c10/util/flat_hash_map.h',
# 'c10/util/logging*.h',
# 'c10/metal/*.h',
# 'c10/util/hash.h',
# 'c10/util/strong_type.h',
# 'c10/util/SmallVector.h',
# 'c10/util/win32-headers.h',
# 'c10/test/**/*.h',
# 'c10/test/**/*.cpp',
# 'third_party/**/*',
# 'torch_npu/csrc/autograd/generated/**',
# 'torch_npu/csrc/distributed/**/*.cu',
# 'torch_npu/csrc/distributed/c10d/WinSockUtils.hpp',
# 'torch_npu/csrc/distributed/c10d/quantization/quantization_gpu.h',
# 'torch_npu/csrc/dynamo/eval_frame.h',
# 'torch_npu/csrc/inductor/aoti_torch/c/shim.h',
# 'torch_npu/csrc/jit/**/*',
# 'torch_npu/csrc/jit/serialization/mobile_bytecode_generated.h',
# 'torch_npu/csrc/utils/generated_serialization_types.h',
# 'torch_npu/csrc/utils/pythoncapi_compat.h',
# 'torch_npu/csrc/inductor/aoti_runtime/sycl_runtime_wrappers.h',
# ]
# init_command = [
# 'python3',
# 'tools/linter/adapters/s3_init.py',
# '--config-json=tools/linter/adapters/s3_init_config.json',
# '--linter=clang-tidy',
# '--dry-run={{DRYRUN}}',
# '--output-dir=.lintbin',
# '--output-name=clang-tidy',
# ]
# command = [
# 'python3',
# 'tools/linter/adapters/clangtidy_linter.py',
# '--binary=.lintbin/clang-tidy',
# '--build_dir=./build',
# '--',
# '@{{PATHSFILE}}'
# ]
# [[linter]]
# code = 'CLANGTIDY_EXECUTORCH_COMPATIBILITY'
# include_patterns = [
# # c10 headers that must be C++17 compatible
# 'c10/macros/Export.h',
# 'c10/macros/Macros.h',
# 'c10/macros/cmake_macros.h',
# 'c10/util/BFloat16.h',
# 'c10/util/BFloat16-inl.h',
# 'c10/util/BFloat16-math.h',
# 'c10/util/Half.h',
# 'c10/util/Half-inl.h',
# 'c10/util/TypeSafeSignMath.h',
# 'c10/util/bit_cast.h',
# 'c10/util/complex.h',
# 'c10/util/floating_point_utils.h',
# 'c10/util/irange.h',
# 'c10/util/llvmMathExtras.h',
# 'c10/util/overflows.h',
# 'c10/util/safe_numerics.h',
# # torch_npu/headeronly headers that must be C++17 compatible
# 'torch_npu/headeronly/macros/cmake_macros.h',
# 'torch_npu/headeronly/macros/Export.h',
# 'torch_npu/headeronly/macros/Macros.h',
# 'torch_npu/headeronly/util/BFloat16.h',
# 'torch_npu/headeronly/util/Half.h',
# 'torch_npu/headeronly/util/TypeSafeSignMath.h',
# 'torch_npu/headeronly/util/bit_cast.h',
# 'torch_npu/headeronly/util/complex.h',
# 'torch_npu/headeronly/util/floating_point_utils.h',
# ]
# exclude_patterns = [
# '**/fb/**',
# ]
# init_command = [
# 'python3',
# 'tools/linter/adapters/s3_init.py',
# '--config-json=tools/linter/adapters/s3_init_config.json',
# '--linter=clang-tidy',
# '--dry-run={{DRYRUN}}',
# '--output-dir=.lintbin',
# '--output-name=clang-tidy',
# ]
# command = [
# 'python3',
# 'tools/linter/adapters/clangtidy_linter.py',
# '--binary=.lintbin/clang-tidy',
# '--build_dir=./build',
# '--std=c++17',
# '--',
# '@{{PATHSFILE}}'
# ]
# [[linter]]
# code = 'TYPEIGNORE'
# include_patterns = ['**/*.py', '**/*.pyi']
# exclude_patterns = [
# 'fb/**',
# '**/fb/**',
# 'test/test_jit.py',
# ]
# command = [
# 'python3',
# 'tools/linter/adapters/grep_linter.py',
# '--pattern=# type:\s*ignore([^\[]|$)',
# '--linter-name=TYPEIGNORE',
# '--error-name=unqualified type: ignore',
# """--error-description=\
# This line has an unqualified `type: ignore`; \
# please convert it to `type: ignore[xxxx]`\
# """,
# '--',
# '@{{PATHSFILE}}'
# ]
# [[linter]]
# code = 'TYPENOSKIP'
# include_patterns = ['mypy.ini']
# command = [
# 'python3',
# 'tools/linter/adapters/grep_linter.py',
# '--pattern=follow_imports\s*=\s*skip',
# '--linter-name=TYPENOSKIP',
# '--error-name=use of follow_imports = skip',
# """--error-description=\
# follow_imports = skip is forbidden from mypy.ini configuration as it \
# is extremely easy to accidentally turn off type checking unintentionally. If \
# you need to suppress type errors, use a top level # mypy: ignore-errors. \
# Do not rely on automatic Any substitution; instead, manually # type: ignore \
# at use sites or define a pyi type stub with more relaxed types. \
# """,
# '--',
# '@{{PATHSFILE}}'
# ]
# [[linter]]
# code = 'NOQA'
# include_patterns = ['**/*.py', '**/*.pyi']
# exclude_patterns = [
# 'caffe2/**',
# 'fb/**',
# '**/fb/**'
# ]
# command = [
# 'python3',
# 'tools/linter/adapters/grep_linter.py',
# '--pattern=# noqa([^:]|$)',
# '--linter-name=NOQA',
# '--error-name=unqualified noqa',
# """--error-description=\
# This line has an unqualified `noqa`; \
# please convert it to `noqa: XXXX`\
# """,
# '--',
# '@{{PATHSFILE}}'
# ]
# [[linter]]
# code = 'NATIVEFUNCTIONS'
# include_patterns=['aten/src/ATen/native/native_functions.yaml']
# command = [
# 'uv',
# 'run',
# '--script',
# 'tools/linter/adapters/nativefunctions_linter.py',
# '--native-functions-yml=aten/src/ATen/native/native_functions.yaml',
# ]
# is_formatter = true
# [[linter]]
# code = 'GHA'
# include_patterns=['.github/workflows/**/*.yml']
# command = [
# 'uv',
# 'run',
# '--script',
# 'tools/linter/adapters/gha_linter.py',
# '--',
# '@{{PATHSFILE}}'
# ]
[[linter]]
code = 'NEWLINE'
include_patterns=['**']
exclude_patterns=[
'**/contrib/**',
'third_party/**',
'**/*.bat',
'**/*.expect',
'**/*.ipynb',
'**/*.ps1',
'**/*.ptl',
'fb/**',
'**/fb/**',
'tools/clang_format_hash/**',
'test/cpp/jit/upgrader_models/*.ptl',
'test/cpp/jit/upgrader_models/*.ptl.ff',
'test/dynamo/cpython/**',
'**/*.png',
'**/*.gz',
'**/*.patch',
'**/*.md',
]
command = [
'python3',
'tools/linter/adapters/newlines_linter.py',
'--',
'@{{PATHSFILE}}',
]
is_formatter = true
[[linter]]
code = 'SPACES'
include_patterns = ['**']
exclude_patterns = [
'**/contrib/**',
'**/*.diff',
'**/*.patch',
'third_party/**',
'aten/src/ATen/native/vulkan/api/vk_mem_alloc.h',
'fb/**',
'**/fb/**',
'test/cpp/jit/upgrader_models/*.ptl',
'test/cpp/jit/upgrader_models/*.ptl.ff',
'**/*.md',
]
command = [
'python3',
'tools/linter/adapters/grep_linter.py',
'--pattern=[[:blank:]]$',
'--linter-name=SPACES',
'--error-name=trailing spaces',
'--replace-pattern=s/[[:blank:]]+$//',
"""--error-description=\
This line has trailing spaces; please remove them.\
""",
'--',
'@{{PATHSFILE}}'
]
# [[linter]]
# code = 'TABS'
# include_patterns = ['**']
# exclude_patterns = [
# '**/*.svg',
# '**/*Makefile',
# '**/contrib/**',
# 'third_party/**',
# '**/.gitattributes',
# '**/.gitmodules',
# 'fb/**',
# '**/fb/**',
# 'aten/src/ATen/native/vulkan/api/vk_mem_alloc.h',
# 'test/cpp/jit/upgrader_models/*.ptl',
# 'test/cpp/jit/upgrader_models/*.ptl.ff',
# '.ci/docker/common/install_rocm_drm.sh',
# '.lintrunner.toml',
# '**/*.patch',
# # NPUGraph logs files
# 'torch_npu/_logging/_internal.py',
# 'torch_npu/csrc/core/npu/NPUGraph.cpp',
# 'torch_npu/csrc/core/npu/NPUGraph.h',
# 'torch_npu/csrc/npu/Graph.cpp',
# 'torch_npu/csrc/core/npu/NPUCachingAllocator.cpp',
# 'torch_npu/csrc/core/npu/NPUWorkspaceAllocator.cpp',
# 'torch_npu/npu/_graph_tree.py',
# 'torch_npu/npu/graphs.py',
# 'torch_npu/utils/_graph_tree.py',
# 'test/npu/test_fault_mode.py',
# 'torch_npu/utils/_dynamo.py',
# 'test/npu/test_resnet.py',
# 'test/npu/test_public_bindings.py',
# 'test/npu/test_compatibility.py',
# ]
# command = [
# 'python3',
# 'tools/linter/adapters/grep_linter.py',
# # @lint-ignore TXT2
# '--pattern= ',
# '--linter-name=TABS',
# '--error-name=saw some tabs',
# '--replace-pattern=s/\t/ /',
# """--error-description=\
# This line has tabs; please replace them with spaces.\
# """,
# '--',
# '@{{PATHSFILE}}'
# ]
# [[linter]]
# code = 'C10_UNUSED'
# include_patterns = [
# '**/*.cpp',
# '**/*.h',
# ]
# exclude_patterns = [
# 'torch_npu/headeronly/macros/Macros.h',
# ]
# command = [
# 'python3',
# 'tools/linter/adapters/grep_linter.py',
# '--pattern=C10_UNUSED',
# '--linter-name=C10_UNUSED',
# '--error-name=deprecated C10_UNUSED macro',
# '--replace-pattern=s/C10_UNUSED/[[maybe_unused]]/',
# """--error-description=\
# Deprecated macro, use [[maybe_unused]] directly\
# """,
# '--',
# '@{{PATHSFILE}}'
# ]
# [[linter]]
# code = 'C10_NODISCARD'
# include_patterns = [
# '**/*.cpp',
# '**/*.h',
# ]
# exclude_patterns = [
# 'torch_npu/headeronly/macros/Macros.h',
# ]
# command = [
# 'python3',
# 'tools/linter/adapters/grep_linter.py',
# '--pattern=C10_NODISCARD',
# '--linter-name=C10_NODISCARD',
# '--error-name=deprecated C10_NODISCARD macro',
# '--replace-pattern=s/C10_NODISCARD/[[nodiscard]]/',
# """--error-description=\
# Deprecated macro, use [[nodiscard]] directly\
# """,
# '--',
# '@{{PATHSFILE}}'
# ]
# [[linter]]
# code = 'RAWTHROW'
# include_patterns = [
# '**/*.cpp',
# '**/*.h',
# ]
# exclude_patterns = [
# # Vendored code (do not modify)
# 'c10/util/flat_hash_map.h',
# 'c10/util/order_preserving_flat_hash_map.h',
# 'aten/src/ATen/native/quantized/cpu/qnnpack/**',
# 'aten/src/ATen/native/transformers/cuda/mem_eff_attention/**',
# # Standalone code that cannot depend on c10
# 'torch_npu/csrc/inductor/aoti_runtime/**',
# # Test files use EXPECT_THROW which is a gtest macro
# 'test/cpp/**/*.cpp',
# # Python C API bindings use python_error/py::error_already_set for exception propagation
# 'torch_npu/csrc/npu/Module.cpp',
# # NPUGraph logs files
# 'torch_npu/csrc/core/npu/NPUGraph.cpp',
# 'torch_npu/csrc/core/npu/NPUGraph.h',
# 'torch_npu/csrc/npu/Graph.cpp',
# 'torch_npu/csrc/core/npu/NPUCachingAllocator.cpp',
# 'torch_npu/csrc/core/npu/NPUWorkspaceAllocator.cpp',
# ]
# command = [
# 'python3',
# 'tools/linter/adapters/rawthrow_linter.py',
# '--linter-name=RAWTHROW',
# '--error-name=raw throw statement',
# """--error-description=\
# Do not use raw `throw` in C++ code. Use TORCH_CHECK, \
# TORCH_CHECK_WITH, C10_THROW_ERROR, or other error-reporting macros \
# instead. See c10/util/Exception.h for available macros. If this is a \
# re-throw (throw;), restructure the code to avoid try/catch/throw or \
# add the file to the RAWTHROW exclude list in .lintrunner.toml with \
# justification.\
# """,
# '--',
# '@{{PATHSFILE}}'
# ]
# [[linter]]
# code = 'INCLUDE'
# include_patterns = [
# 'c10/**',
# 'aten/**',
# 'torch_npu/csrc/**',
# 'torch_npu/nativert/**',
# ]
# exclude_patterns = [
# 'aten/src/ATen/native/quantized/cpu/qnnpack/**',
# 'aten/src/ATen/native/vulkan/api/vk_mem_alloc.h',
# 'aten/src/ATen/native/vulkan/glsl/**',
# '**/fb/**',
# 'torch_npu/csrc/jit/serialization/mobile_bytecode_generated.h',
# 'torch_npu/csrc/utils/pythoncapi_compat.h',
# 'torch_npu/csrc/core/npu/NPUCachingAllocator.cpp',
# 'torch_npu/csrc/core/npu/NPUWorkspaceAllocator.cpp',
# ]
# command = [
# 'python3',
# 'tools/linter/adapters/grep_linter.py',
# '--pattern=#include "',
# '--linter-name=INCLUDE',
# '--error-name=quoted include',
# '--replace-pattern=s/#include "(.*)"$/#include <\1>/',
# """--error-description=\
# This #include uses quotes; please convert it to #include <xxxx>\
# """,
# '--',
# '@{{PATHSFILE}}'
# ]
# [[linter]]
# code = 'PYBIND11_INCLUDE'
# include_patterns = [
# '**/*.cpp',
# '**/*.h',
# ]
# exclude_patterns = [
# 'torch_npu/csrc/utils/pybind.h',
# 'torch_npu/utils/benchmark/utils/valgrind_wrapper/compat_bindings.cpp',
# 'caffe2/**/*',
# ]
# command = [
# 'python3',
# 'tools/linter/adapters/grep_linter.py',
# '--pattern=#include <pybind11\/(^|[^(gil_simple\.h)])',
# '--allowlist-pattern=#include <torch\/csrc\/utils\/pybind.h>',
# '--linter-name=PYBIND11_INCLUDE',
# '--match-first-only',
# '--error-name=direct include of pybind11',
# # https://stackoverflow.com/a/33416489/23845
# # NB: this won't work if the pybind11 include is on the first line;
# # but that's fine because it will just mean the lint will still fail
# # after applying the change and you will have to fix it manually
# '--replace-pattern=1,/(#include <pybind11\/)/ s/(#include <pybind11\/)/#include <torch\/csrc\/utils\/pybind.h>\n\1/',
# """--error-description=\
# This #include directly includes pybind11 without also including \
# #include <torch_npu/csrc/utils/pybind.h>; this means some important \
# specializations may not be included.\
# """,
# '--',
# '@{{PATHSFILE}}'
# ]
# [[linter]]
# code = 'ERROR_PRONE_ISINSTANCE'
# include_patterns = [
# 'torch_npu/_refs/**/*.py',
# 'torch_npu/_prims/**/*.py',
# 'torch_npu/_prims_common/**/*.py',
# 'torch_npu/_decomp/**/*.py',
# 'torch_npu/_meta_registrations.py',
# ]
# exclude_patterns = [
# '**/fb/**',
# ]
# command = [
# 'python3',
# 'tools/linter/adapters/grep_linter.py',
# '--pattern=isinstance\([^)]+(int|float)\)',
# '--linter-name=ERROR_PRONE_ISINSTANCE',
# '--error-name=error prone isinstance',
# """--error-description=\
# This line has an isinstance call that directly refers to \
# int or float. This is error-prone because you may also \
# have wanted to allow SymInt or SymFloat in your test. \
# To suppress this lint, use an appropriate type alias defined \
# in torch._prims_common; use IntLike/FloatLike when you would accept \
# both regular and symbolic numbers, Dim for ints representing \
# dimensions, or IntWithoutSymInt/FloatWithoutSymFloat if you really \
# meant to exclude symbolic numbers.
# """,
# '--',
# '@{{PATHSFILE}}'
# ]
# [[linter]]
# code = 'PYBIND11_SPECIALIZATION'
# include_patterns = [
# '**/*.cpp',
# '**/*.h',
# ]
# exclude_patterns = [
# # The place for all orphan specializations
# 'torch_npu/csrc/utils/pybind.h',
# # These specializations are non-orphan
# 'torch_npu/csrc/distributed/c10d/init.cpp',
# 'torch_npu/csrc/jit/python/pybind.h',
# 'fb/**',
# '**/fb/**',
# # These are safe to exclude as they do not have Python
# 'c10/**/*',
# ]
# command = [
# 'python3',
# 'tools/linter/adapters/grep_linter.py',
# '--pattern=PYBIND11_DECLARE_HOLDER_TYPE',
# '--linter-name=PYBIND11_SPECIALIZATION',
# '--error-name=pybind11 specialization in non-standard location',
# """--error-description=\
# This pybind11 specialization (PYBIND11_DECLARE_HOLDER_TYPE) should \
# be placed in torch_npu/csrc/utils/pybind.h so that it is guaranteed to be \
# included at any site that may potentially make use of it via py::cast. \
# If your specialization is in the same header file as the definition \
# of the holder type, you can ignore this lint by adding your header to \
# the exclude_patterns for this lint in .lintrunner.toml. For more \
# information see https://github.com/pybind/pybind11/issues/4099 \
# """,
# '--',
# '@{{PATHSFILE}}'
# ]
# [[linter]]
# code = 'PYPIDEP'
# include_patterns = ['.github/**']
# exclude_patterns = [
# '**/*.rst',
# '**/*.py',
# '**/*.md',
# '**/*.diff',
# '**/fb/**',
# ]
# command = [
# 'python3',
# 'tools/linter/adapters/grep_linter.py',
# """--pattern=\
# (pip|pip3|python -m pip|python3 -m pip|python3 -mpip|python -mpip) \
# install ([a-zA-Z0-9][A-Za-z0-9\\._\\-]+)([^/=<>~!]+)[A-Za-z0-9\\._\\-\\*\\+\\!]*$\
# """,
# '--linter-name=PYPIDEP',
# '--error-name=unpinned PyPI install',
# """--error-description=\
# This line has unpinned PyPi installs; \
# please pin them to a specific version: e.g. 'thepackage==1.2'\
# """,
# '--',
# '@{{PATHSFILE}}'
# ]
# [[linter]]
# code = 'EXEC'
# include_patterns = ['**']
# exclude_patterns = [
# 'third_party/**',
# 'torch_npu/bin/**',
# '**/*.so',
# '**/*.py',
# '**/*.sh',
# '**/*.bash',
# '**/git-pre-commit',
# '**/git-clang-format',
# '**/gradlew',
# 'fb/**',
# '**/fb/**',
# ]
# command = [
# 'python3',
# 'tools/linter/adapters/exec_linter.py',
# '--',
# '@{{PATHSFILE}}',
# ]
# [[linter]]
# code = 'CUBINCLUDE'
# include_patterns = ['aten/**']
# exclude_patterns = [
# 'aten/src/ATen/cuda/cub*.cuh',
# '**/fb/**',
# ]
# command = [
# 'python3',
# 'tools/linter/adapters/grep_linter.py',
# '--pattern=#include <cub/',
# '--linter-name=CUBINCLUDE',
# '--error-name=direct cub include',
# """--error-description=\
# This line has a direct cub include; please include \
# ATen/cuda/cub.cuh instead and wrap your cub calls in \
# at::native namespace if necessary.
# """,
# '--',
# '@{{PATHSFILE}}'
# ]
# [[linter]]
# code = 'RAWCUDA'
# include_patterns = [
# 'aten/**',
# 'c10/**',
# ]
# exclude_patterns = [
# 'aten/src/ATen/test/**',
# 'c10/cuda/CUDAFunctions.h',
# 'c10/cuda/CUDACachingAllocator.cpp',
# '**/fb/**',
# ]
# command = [
# 'python3',
# 'tools/linter/adapters/grep_linter.py',
# '--pattern=cudaStreamSynchronize',
# '--linter-name=RAWCUDA',
# '--error-name=raw CUDA API usage',
# """--error-description=\
# This line calls raw CUDA APIs directly; please use at::cuda wrappers instead.
# """,
# '--',
# '@{{PATHSFILE}}'
# ]
# [[linter]]
# code = 'RAWCUDADEVICE'
# include_patterns = [
# 'aten/**',
# 'c10/**',
# 'torch_npu/csrc/**',
# 'torch_npu/nativert/**',
# ]
# exclude_patterns = [
# 'aten/src/ATen/cuda/CUDAContext.cpp',
# 'aten/src/ATen/cuda/CUDAGeneratorImpl.cpp',
# 'aten/src/ATen/test/**',
# 'c10/core/impl/InlineDeviceGuard.h',
# 'c10/cuda/CUDAFunctions.cpp',
# 'c10/cuda/CUDAGuard.h',
# 'c10/cuda/impl/CUDATest.cpp',
# 'torch_npu/csrc/cuda/nccl.cpp',
# '**/fb/**',
# ]
# command = [
# 'python3',
# 'tools/linter/adapters/grep_linter.py',
# '--pattern=(cudaSetDevice|cudaGetDevice)\\(',
# '--linter-name=RAWCUDADEVICE',
# '--error-name=raw CUDA API usage',
# """--error-description=\
# This line calls raw CUDA APIs directly; please use c10::cuda wrappers instead.
# """,
# '--',
# '@{{PATHSFILE}}'
# ]
# [[linter]]
# code = 'ROOT_LOGGING'
# include_patterns = [
# '**/*.py',
# ]
# # These are not library code, but scripts in their own right, and so
# # therefore are permitted to use logging
# exclude_patterns = [
# 'tools/**',
# 'test/**',
# 'benchmarks/**',
# 'torch_npu/distributed/run.py',
# 'functorch/benchmarks/**',
# # Grandfathered in
# 'caffe2/**',
# 'fb/**',
# '**/fb/**',
# # NPUGraph logs files
# 'torch_npu/_logging/_internal.py',
# 'torch_npu/npu/_graph_tree.py',
# 'torch_npu/npu/graphs.py',
# 'torch_npu/utils/_graph_tree.py',
# ]
# command = [
# 'python3',
# 'tools/linter/adapters/grep_linter.py',
# '--pattern=logging\.(debug|info|warn|warning|error|critical|log|exception)\(',
# '--replace-pattern=s/logging\.(debug|info|warn|warning|error|critical|log|exception)\(/log.\1(/',
# '--linter-name=ROOT_LOGGING',
# '--error-name=use of root logger',
# """--error-description=\
# Do not use root logger (logging.info, etc) directly; instead \
# define 'log = logging.getLogger(__name__)' and call, e.g., log.info().
# """,
# '--',
# '@{{PATHSFILE}}'
# ]
# [[linter]]
# code = 'DEPLOY_DETECTION'
# include_patterns = [
# '**/*.py',
# ]
# command = [
# 'python3',
# 'tools/linter/adapters/grep_linter.py',
# '--pattern=sys\.executable == .torch_deploy.',
# '--replace-pattern=s/sys\.executable == .torch_deploy./torch._running_with_deploy\(\)/',
# '--linter-name=DEPLOY_DETECTION',
# '--error-name=properly detect deploy runner',
# """--error-description=\
# Do not use sys.executable to detect if running within deploy/multipy, use torch._running_with_deploy().
# """,
# '--',
# '@{{PATHSFILE}}'
# ]
# [[linter]]
# code = 'CMAKE'
# include_patterns = [
# "**/*.cmake",
# "**/*.cmake.in",
# "**/CMakeLists.txt",
# ]
# exclude_patterns = [
# 'cmake/Modules/**',
# 'cmake/Modules_CUDA_fix/**',
# 'cmake/Caffe2Config.cmake.in',
# 'aten/src/ATen/ATenConfig.cmake.in',
# 'cmake/TorchConfig.cmake.in',
# 'cmake/TorchConfigVersion.cmake.in',
# 'cmake/cmake_uninstall.cmake.i',
# 'fb/**',
# '**/fb/**',
# ]
# command = [
# 'uv',
# 'run',
# '--script',
# 'tools/linter/adapters/cmake_linter.py',
# '--config=.cmakelintrc',
# '--',
# '@{{PATHSFILE}}',
# ]
# [[linter]]
# code = 'SHELLCHECK'
# include_patterns = [
# '.ci/pytorch_npu/**/*.sh'
# ]
# exclude_patterns = [
# '**/fb/**',
# ]
# command = [
# 'uv',
# 'run',
# '--script',
# 'tools/linter/adapters/shellcheck_linter.py',
# '--',
# '@{{PATHSFILE}}',
# ]
# [[linter]]
# code = 'ACTIONLINT'
# include_patterns = [
# '.github/workflows/*.yml',
# '.github/workflows/*.yaml',
# # actionlint does not support composite actions yet
# # '.github/actions/**/*.yml',
# # '.github/actions/**/*.yaml',
# ]
# exclude_patterns = [
# '**/fb/**',
# ]
# command = [
# 'python3',
# 'tools/linter/adapters/actionlint_linter.py',
# '--binary=.lintbin/actionlint',
# '--',
# '@{{PATHSFILE}}',
# ]
# init_command = [
# 'python3',
# 'tools/linter/adapters/s3_init.py',
# '--config-json=tools/linter/adapters/s3_init_config.json',
# '--linter=actionlint',
# '--dry-run={{DRYRUN}}',
# '--output-dir=.lintbin',
# '--output-name=actionlint',
# ]
# # [[linter]]
# # code = 'TESTOWNERS'
# # include_patterns = [
# # 'test/**/test_*.py',
# # 'test/**/*_test.py',
# # ]
# # exclude_patterns = [
# # 'test/run_test.py',
# # '**/fb/**',
# # ]
# # command = [
# # 'python3',
# # 'tools/linter/adapters/testowners_linter.py',
# # '--',
# # '@{{PATHSFILE}}',
# # ]
# [[linter]]
# code = 'TEST_HAS_MAIN'
# include_patterns = [
# 'test/**/test_*.py',
# ]
# exclude_patterns = [
# 'test/run_test.py',
# '**/fb/**',
# 'test/dynamo/cpython/3.13/**',
# 'test/quantization/**', # should be run through test/test_quantization.py
# 'test/jit/**', # should be run through test/test_jit.py
# 'test/ao/sparsity/**', # should be run through test/test_ao_sparsity.py
# 'test/fx/**', # should be run through test/test_fx.py
# 'test/package/**', # excluded by test/run_test.py
# 'test/distributed/argparse_util_test.py',
# 'test/distributed/bin/test_script.py',
# 'test/distributed/elastic/agent/server/test/local_elastic_agent_test.py',
# 'test/distributed/elastic/multiprocessing/bin/test_script.py',
# 'test/distributed/elastic/multiprocessing/bin/zombie_test.py',
# 'test/distributed/elastic/multiprocessing/errors/api_test.py',
# 'test/distributed/elastic/multiprocessing/errors/error_handler_test.py',
# 'test/distributed/elastic/multiprocessing/redirects_test.py',
# 'test/distributed/elastic/multiprocessing/tail_log_test.py',
# 'test/distributed/elastic/rendezvous/api_test.py',
# 'test/distributed/elastic/rendezvous/c10d_rendezvous_backend_test.py',
# 'test/distributed/elastic/rendezvous/dynamic_rendezvous_test.py',
# 'test/distributed/elastic/rendezvous/etcd_rendezvous_backend_test.py',
# 'test/distributed/elastic/rendezvous/etcd_rendezvous_test.py',
# 'test/distributed/elastic/rendezvous/etcd_server_test.py',
# 'test/distributed/elastic/rendezvous/rendezvous_backend_test.py',
# 'test/distributed/elastic/rendezvous/static_rendezvous_test.py',
# 'test/distributed/elastic/rendezvous/utils_test.py',
# 'test/distributed/elastic/timer/api_test.py',
# 'test/distributed/elastic/utils/data/cycling_iterator_test.py',
# 'test/distributed/launcher/api_test.py',
# 'test/distributed/launcher/bin/test_script.py',
# 'test/distributed/launcher/bin/test_script_init_method.py',
# 'test/distributed/launcher/bin/test_script_is_torchelastic_launched.py',
# 'test/distributed/launcher/bin/test_script_local_rank.py',
# 'test/distributed/launcher/launch_test.py',
# 'test/distributed/launcher/run_test.py',
# 'test/distributed/optim/test_apply_optimizer_in_backward.py',
# 'test/distributed/optim/test_named_optimizer.py',
# 'test/distributed/test_c10d_spawn.py',
# 'test/distributed/test_collective_utils.py',
# 'test/distributions/test_distributions.py',
# 'test/inductor/test_aot_inductor_utils.py',
# 'test/lazy/test_bindings.py',
# 'test/lazy/test_extract_compiled_graph.py',
# 'test/lazy/test_meta_kernel.py',
# 'test/nn/test_init.py',
# 'test/onnx/model_defs/op_test.py',
# 'test/onnx/test_models_quantized_onnxruntime.py',
# 'test/onnx/test_onnxscript_no_runtime.py',
# 'test/onnx_caffe2/test_caffe2_common.py',
# 'test/optim/test_lrscheduler.py',
# 'test/optim/test_optim.py',
# 'test/optim/test_swa_utils.py',
# 'test/run_test.py',
# 'test/test_bundled_images.py',
# 'test/test_cuda_expandable_segments.py',
# 'test/test_hub.py',
# ]
# command = [
# 'uv',
# 'run',
# '--script',
# 'tools/linter/adapters/test_has_main_linter.py',
# '--',
# '@{{PATHSFILE}}',
# ]
# [[linter]]
# code = 'CALL_ONCE'
# include_patterns = [
# 'c10/**',
# 'aten/**',
# 'torch_npu/csrc/**',
# 'torch_npu/nativert/**',
# ]
# exclude_patterns = [
# 'c10/util/CallOnce.h',
# '**/fb/**',
# ]
# command = [
# 'python3',
# 'tools/linter/adapters/grep_linter.py',
# '--pattern=std::call_once',
# '--linter-name=CALL_ONCE',
# '--error-name=invalid call_once',
# '--replace-pattern=s/std::call_once/c10::call_once/',
# """--error-description=\
# Use of std::call_once is forbidden and should be replaced with c10::call_once\
# """,
# '--',
# '@{{PATHSFILE}}'
# ]
# [[linter]]
# code = 'CONTEXT_DECORATOR'
# include_patterns = [
# 'torch_npu/**',
# ]
# command = [
# 'python3',
# 'tools/linter/adapters/grep_linter.py',
# '--pattern=@.*(dynamo_timed|preserve_rng_state|clear_frame|with_fresh_cache_if_config|use_lazy_graph_module|_disable_current_modes)',
# '--allowlist-pattern=clear_frames',
# '--linter-name=CONTEXT_DECORATOR',
# '--error-name=avoid context decorator',
# """--error-description=\
# Do not use context manager as decorator as it breaks cProfile traces. Use it as \
# a context manager instead\
# """,
# '--',
# '@{{PATHSFILE}}'
# ]
# [[linter]]
# code = 'ONCE_FLAG'
# include_patterns = [
# 'c10/**',
# 'aten/**',
# 'torch_npu/csrc/**',
# 'torch_npu/nativert/**',
# ]
# exclude_patterns = [
# '**/fb/**',
# ]
# command = [
# 'python3',
# 'tools/linter/adapters/grep_linter.py',
# '--pattern=std::once_flag',
# '--linter-name=ONCE_FLAG',
# '--error-name=invalid once_flag',
# '--replace-pattern=s/std::once_flag/c10::once_flag/',
# """--error-description=\
# Use of std::once_flag is forbidden and should be replaced with c10::once_flag\
# """,
# '--',
# '@{{PATHSFILE}}'
# ]
# [[linter]]
# code = 'WORKFLOWSYNC'
# include_patterns = [
# '.github/workflows/*.yml',
# '.github/workflows/*.yaml',
# ]
# command = [
# 'uv',
# 'run',
# '--script',
# 'tools/linter/adapters/workflow_consistency_linter.py',
# '--',
# '@{{PATHSFILE}}'
# ]
# [[linter]]
# code = 'NO_WORKFLOWS_ON_FORK'
# include_patterns = [
# '.github/**/*.yml',
# '.github/**/*.yaml',
# ]
# exclude_patterns = [
# '**/fb/**',
# ]
# command = [
# 'uv',
# 'run',
# '--script',
# 'tools/linter/adapters/no_workflows_on_fork.py',
# '--',
# '@{{PATHSFILE}}',
# ]
# [[linter]]
# code = 'CODESPELL'
# command = [
# 'uv',
# 'run',
# '--script',
# 'tools/linter/adapters/codespell_linter.py',
# '--',
# '@{{PATHSFILE}}'
# ]
# include_patterns = [
# '**',
# ]
# exclude_patterns = [
# # We don't care too much about files in this directory, don't enforce
# # spelling on them
# 'caffe2/**',
# 'fb/**',
# '**/fb/**',
# 'test/npu/test_fault_mode.py',
# 'torch_npu/utils/_dynamo.py',
# 'test/npu/test_resnet.py',
# 'test/npu/test_public_bindings.py',
# 'test/npu/test_compatibility.py',
# 'third_party/**',
# 'test/dynamo/cpython/**',
# 'torch_npu/_vendor/**',
# 'torch_npu/_inductor/fx_passes/serialized_patterns/**',
# 'torch_npu/_inductor/autoheuristic/artifacts/**',
# 'torch_npu/_inductor/kernel/vendored_templates/cutedsl/kernels/**',
# 'torch_npu/_inductor/kernel/vendored_templates/cutedsl/dense_blockscaled_gemm_persistent.py',
# 'torch_npu/utils/model_dump/preact.mjs',
# # NPUGraph logs files
# 'torch_npu/_logging/_internal.py',
# 'torch_npu/csrc/core/npu/NPUGraph.cpp',
# 'torch_npu/csrc/core/npu/NPUGraph.h',
# 'torch_npu/csrc/npu/Graph.cpp',
# 'torch_npu/csrc/core/npu/NPUCachingAllocator.cpp',
# 'torch_npu/csrc/core/npu/NPUWorkspaceAllocator.cpp',
# 'torch_npu/npu/_graph_tree.py',
# 'torch_npu/npu/graphs.py',
# 'torch_npu/utils/_graph_tree.py',
# ]
# is_formatter = true
# # usort + ruff-format
# [[linter]]
# code = 'PYFMT'
# include_patterns = [
# '**/*.py',
# '**/*.pyi',
# ]
# command = [
# 'uv',
# 'run',
# '--script',
# 'tools/linter/adapters/pyfmt_linter.py',
# '--',
# '@{{PATHSFILE}}'
# ]
# exclude_patterns = [
# 'tools/gen_vulkan_spv.py',
# # We don't care too much about files in this directory, don't enforce
# # formatting on them
# 'caffe2/**/*.py',
# 'caffe2/**/*.pyi',
# 'fb/**',
# '**/fb/**',
# 'test/dynamo/cpython/**',
# 'third_party/**/*.py',
# 'third_party/**/*.pyi',
# 'torch_npu/_vendor/**',
# 'torch_npu/_inductor/fx_passes/serialized_patterns/**',
# 'torch_npu/_inductor/autoheuristic/artifacts/**',
# # Needs Python 3.12+
# 'torch_npu/testing/_internal/py312_intrinsics.py',
# # These files are all grandfathered in, feel free to remove from this list
# # as necessary
# 'test/quantization/__init__.py',
# 'test/quantization/core/__init__.py',
# 'test/quantization/core/experimental/apot_fx_graph_mode_ptq.py',
# 'test/quantization/core/experimental/apot_fx_graph_mode_qat.py',
# 'test/quantization/core/experimental/quantization_util.py',
# 'test/quantization/core/experimental/test_bits.py',
# 'test/quantization/core/experimental/test_fake_quantize.py',
# 'test/quantization/core/experimental/test_linear.py',
# 'test/quantization/core/experimental/test_nonuniform_observer.py',
# 'test/quantization/core/experimental/test_quantized_tensor.py',
# 'test/quantization/core/experimental/test_quantizer.py',
# 'test/quantization/core/test_backend_config.py',
# 'test/quantization/core/test_docs.py',
# 'test/quantization/core/test_quantized_functional.py',
# 'test/quantization/core/test_quantized_module.py',
# 'test/quantization/core/test_quantized_op.py',
# 'test/quantization/core/test_quantized_tensor.py',
# 'test/quantization/core/test_top_level_apis.py',
# 'test/quantization/core/test_utils.py',
# 'test/quantization/core/test_workflow_module.py',
# 'test/quantization/core/test_workflow_ops.py',
# 'test/quantization/fx/__init__.py',
# 'test/quantization/fx/test_equalize_fx.py',
# 'test/quantization/fx/test_model_report_fx.py',
# 'test/quantization/fx/test_numeric_suite_fx.py',
# 'test/quantization/fx/test_quantize_fx.py',
# 'test/quantization/fx/test_subgraph_rewriter.py',
# 'test/test_function_schema.py',
# 'test/test_functional_autograd_benchmark.py',
# 'test/test_functional_optim.py',
# 'test/test_functionalization_of_rng_ops.py',
# 'test/test_datapipe.py',
# 'test/test_futures.py',
# 'test/test_fx.py',
# 'test/test_fx_experimental.py',
# 'test/test_fx_passes.py',
# 'test/test_fx_reinplace_pass.py',
# 'test/test_import_stats.py',
# 'test/test_itt.py',
# 'test/test_jit.py',
# 'test/test_jit_autocast.py',
# 'test/test_jit_cuda_fuser.py',
# 'test/test_jit_disabled.py',
# 'test/test_jit_fuser.py',
# 'test/test_jit_fuser_legacy.py',
# 'test/test_jit_legacy.py',
# 'test/test_jit_llga_fuser.py',
# 'test/test_jit_profiling.py',
# 'test/test_jit_simple.py',
# 'test/test_jit_string.py',
# 'test/test_jiterator.py',
# 'test/test_kernel_launch_checks.py',
# 'test/test_linalg.py',
# 'test/test_masked.py',
# 'test/test_maskedtensor.py',
# 'test/test_matmul_cuda.py',
# 'test/test_scaled_matmul_cuda.py',
# 'test/test_meta.py',
# 'test/test_metal.py',
# 'test/test_mkl_verbose.py',
# 'test/test_mkldnn.py',
# 'test/test_mkldnn_fusion.py',
# 'test/test_mkldnn_verbose.py',
# 'test/test_mobile_optimizer.py',
# 'test/test_model_dump.py',
# 'test/test_modules.py',
# 'test/test_monitor.py',
# 'test/test_mps.py',
# 'test/test_multiprocessing_spawn.py',
# 'test/test_namedtensor.py',
# 'test/test_namedtuple_return_api.py',
# 'test/test_native_functions.py',
# 'test/test_native_mha.py',
# 'test/test_nn.py',
# 'test/test_out_dtype_op.py',
# 'test/test_overrides.py',
# 'test/test_prims.py',
# 'test/test_proxy_tensor.py',
# 'test/test_pruning_op.py',
# 'test/test_quantization.py',
# 'test/test_reductions.py',
# 'test/test_scatter_gather_ops.py',
# 'test/test_schema_check.py',
# 'test/test_segment_reductions.py',
# 'test/test_serialization.py',
# 'test/test_set_default_mobile_cpu_allocator.py',
# 'test/test_sparse.py',
# 'test/test_sparse_csr.py',
# 'test/test_sparse_semi_structured.py',
# 'test/test_spectral_ops.py',
# 'test/test_stateless.py',
# 'test/test_static_runtime.py',
# 'test/test_subclass.py',
# 'test/test_sympy_utils.py',
# 'test/test_tensor_creation_ops.py',
# 'test/test_tensorboard.py',
# 'test/test_tensorexpr.py',
# 'test/test_tensorexpr_pybind.py',
# 'test/test_testing.py',
# 'test/test_torch.py',
# 'test/test_transformers.py',
# 'test/test_type_promotion.py',
# 'test/test_unary_ufuncs.py',
# 'test/test_vulkan.py',
# 'test/npu/test_fault_mode.py',
# 'torch_npu/utils/_dynamo.py',
# 'test/npu/test_resnet.py',
# 'test/npu/test_public_bindings.py',
# 'test/npu/test_compatibility.py',
# 'torch_npu/_awaits/__init__.py',
# 'torch_npu/_export/__init__.py',
# 'torch_npu/_export/constraints.py',
# 'torch_npu/_export/db/__init__.py',
# 'torch_npu/_export/db/case.py',
# 'torch_npu/_export/db/examples/__init__.py',
# 'torch_npu/_export/db/examples/assume_constant_result.py',
# 'torch_npu/_export/db/examples/autograd_function.py',
# 'torch_npu/_export/db/examples/class_method.py',
# 'torch_npu/_export/db/examples/cond_branch_class_method.py',
# 'torch_npu/_export/db/examples/cond_branch_nested_function.py',
# 'torch_npu/_export/db/examples/cond_branch_nonlocal_variables.py',
# 'torch_npu/_export/db/examples/cond_closed_over_variable.py',
# 'torch_npu/_export/db/examples/cond_operands.py',
# 'torch_npu/_export/db/examples/cond_predicate.py',
# 'torch_npu/_export/db/examples/decorator.py',
# 'torch_npu/_export/db/examples/dictionary.py',
# 'torch_npu/_export/db/examples/dynamic_shape_assert.py',
# 'torch_npu/_export/db/examples/dynamic_shape_constructor.py',
# 'torch_npu/_export/db/examples/dynamic_shape_if_guard.py',
# 'torch_npu/_export/db/examples/dynamic_shape_map.py',
# 'torch_npu/_export/db/examples/dynamic_shape_round.py',
# 'torch_npu/_export/db/examples/dynamic_shape_slicing.py',
# 'torch_npu/_export/db/examples/dynamic_shape_view.py',
# 'torch_npu/_export/db/examples/fn_with_kwargs.py',
# 'torch_npu/_export/db/examples/list_contains.py',
# 'torch_npu/_export/db/examples/list_unpack.py',
# 'torch_npu/_export/db/examples/nested_function.py',
# 'torch_npu/_export/db/examples/null_context_manager.py',
# 'torch_npu/_export/db/examples/pytree_flatten.py',
# 'torch_npu/_export/db/examples/scalar_output.py',
# 'torch_npu/_export/db/examples/specialized_attribute.py',
# 'torch_npu/_export/db/examples/static_for_loop.py',
# 'torch_npu/_export/db/examples/static_if.py',
# 'torch_npu/_export/db/examples/tensor_setattr.py',
# 'torch_npu/_export/db/examples/type_reflection_method.py',
# 'torch_npu/_export/db/gen_example.py',
# 'torch_npu/_export/db/logging.py',
# 'torch_npu/testing/_internal/__init__.py',
# 'torch_npu/testing/_internal/autocast_test_lists.py',
# 'torch_npu/testing/_internal/autograd_function_db.py',
# 'torch_npu/testing/_internal/check_kernel_launches.py',
# 'torch_npu/testing/_internal/codegen/__init__.py',
# 'torch_npu/testing/_internal/codegen/random_topo_test.py',
# 'torch_npu/testing/_internal/common_cuda.py',
# 'torch_npu/testing/_internal/common_jit.py',
# 'torch_npu/testing/_internal/common_methods_invocations.py',
# 'torch_npu/testing/_internal/common_modules.py',
# 'torch_npu/testing/_internal/common_nn.py',
# 'torch_npu/testing/_internal/common_pruning.py',
# 'torch_npu/testing/_internal/common_quantization.py',
# 'torch_npu/testing/_internal/common_quantized.py',
# 'torch_npu/testing/_internal/common_subclass.py',
# 'torch_npu/testing/_internal/common_utils.py',
# 'torch_npu/testing/_internal/composite_compliance.py',
# 'torch_npu/testing/_internal/hop_db.py',
# 'torch_npu/testing/_internal/custom_op_db.py',
# 'torch_npu/testing/_internal/data/__init__.py',
# 'torch_npu/testing/_internal/data/network1.py',
# 'torch_npu/testing/_internal/data/network2.py',
# 'torch_npu/testing/_internal/dist_utils.py',
# 'torch_npu/testing/_internal/generated/__init__.py',
# 'torch_npu/testing/_internal/hypothesis_utils.py',
# 'torch_npu/testing/_internal/inductor_utils.py',
# 'torch_npu/testing/_internal/jit_metaprogramming_utils.py',
# 'torch_npu/testing/_internal/jit_utils.py',
# 'torch_npu/testing/_internal/logging_tensor.py',
# 'torch_npu/testing/_internal/logging_utils.py',
# 'torch_npu/testing/_internal/optests/__init__.py',
# 'torch_npu/testing/_internal/optests/aot_autograd.py',
# 'torch_npu/testing/_internal/optests/compile_check.py',
# 'torch_npu/testing/_internal/optests/fake_tensor.py',
# 'torch_npu/testing/_internal/optests/make_fx.py',
# 'torch_npu/testing/_internal/quantization_torch_package_models.py',
# 'torch_npu/testing/_internal/test_module/__init__.py',
# 'torch_npu/testing/_internal/test_module/future_div.py',
# 'torch_npu/testing/_internal/test_module/no_future_div.py',
# 'torch_npu/utils/benchmark/__init__.py',
# 'torch_npu/utils/benchmark/examples/__init__.py',
# 'torch_npu/utils/benchmark/examples/compare.py',
# 'torch_npu/utils/benchmark/examples/fuzzer.py',
# 'torch_npu/utils/benchmark/examples/op_benchmark.py',
# 'torch_npu/utils/benchmark/examples/simple_timeit.py',
# 'torch_npu/utils/benchmark/examples/sparse/compare.py',
# 'torch_npu/utils/benchmark/examples/sparse/fuzzer.py',
# 'torch_npu/utils/benchmark/examples/sparse/op_benchmark.py',
# 'torch_npu/utils/benchmark/examples/spectral_ops_fuzz_test.py',
# 'torch_npu/utils/benchmark/op_fuzzers/__init__.py',
# 'torch_npu/utils/benchmark/op_fuzzers/binary.py',
# 'torch_npu/utils/benchmark/op_fuzzers/sparse_binary.py',
# 'torch_npu/utils/benchmark/op_fuzzers/sparse_unary.py',
# 'torch_npu/utils/benchmark/op_fuzzers/spectral.py',
# 'torch_npu/utils/benchmark/op_fuzzers/unary.py',
# 'torch_npu/utils/benchmark/utils/__init__.py',
# 'torch_npu/utils/benchmark/utils/_stubs.py',
# 'torch_npu/utils/benchmark/utils/common.py',
# 'torch_npu/utils/benchmark/utils/compare.py',
# 'torch_npu/utils/benchmark/utils/compile.py',
# 'torch_npu/utils/benchmark/utils/cpp_jit.py',
# 'torch_npu/utils/benchmark/utils/fuzzer.py',
# 'torch_npu/utils/benchmark/utils/sparse_fuzzer.py',
# 'torch_npu/utils/benchmark/utils/timer.py',
# 'torch_npu/utils/benchmark/utils/valgrind_wrapper/__init__.py',
# 'torch_npu/utils/benchmark/utils/valgrind_wrapper/timer_interface.py',
# 'torch_npu/utils/bundled_inputs.py',
# 'torch_npu/utils/checkpoint.py',
# 'torch_npu/utils/collect_env.py',
# 'torch_npu/utils/cpp_backtrace.py',
# 'torch_npu/utils/cpp_extension.py',
# 'torch_npu/utils/dlpack.py',
# 'torch_npu/utils/file_baton.py',
# 'torch_npu/utils/flop_counter.py',
# 'torch_npu/utils/hipify/__init__.py',
# 'torch_npu/utils/hipify/constants.py',
# 'torch_npu/utils/hipify/cuda_to_hip_mappings.py',
# 'torch_npu/utils/hipify/hipify_python.py',
# 'torch_npu/utils/hipify/version.py',
# 'torch_npu/utils/hooks.py',
# 'torch_npu/utils/jit/__init__.py',
# 'torch_npu/utils/jit/log_extract.py',
# 'torch_npu/utils/mkldnn.py',
# 'torch_npu/utils/mobile_optimizer.py',
# 'torch_npu/utils/model_dump/__init__.py',
# 'torch_npu/utils/model_dump/__main__.py',
# 'torch_npu/utils/model_zoo.py',
# 'torch_npu/utils/show_pickle.py',
# 'torch_npu/utils/tensorboard/__init__.py',
# 'torch_npu/utils/tensorboard/_caffe2_graph.py',
# 'torch_npu/utils/tensorboard/_convert_np.py',
# 'torch_npu/utils/tensorboard/_embedding.py',
# 'torch_npu/utils/tensorboard/_onnx_graph.py',
# 'torch_npu/utils/tensorboard/_proto_graph.py',
# 'torch_npu/utils/tensorboard/_pytorch_graph.py',
# 'torch_npu/utils/tensorboard/_utils.py',
# 'torch_npu/utils/tensorboard/summary.py',
# 'torch_npu/utils/tensorboard/writer.py',
# 'torch_npu/utils/throughput_benchmark.py',
# 'torch_npu/utils/viz/__init__.py',
# 'torch_npu/utils/viz/_cycles.py',
# # NPUGraph logs files
# 'torch_npu/_logging/_internal.py',
# 'torch_npu/npu/_graph_tree.py',
# 'torch_npu/npu/graphs.py',
# 'torch_npu/utils/_graph_tree.py',
# ]
# is_formatter = true
# [[linter]]
# code = 'PYPROJECT'
# command = [
# 'uv',
# 'run',
# '--script',
# 'tools/linter/adapters/pyproject_linter.py',
# '--',
# '@{{PATHSFILE}}'
# ]
# include_patterns = [
# "**/pyproject.toml",
# ]
# [[linter]]
# code = 'CMAKE_MINIMUM_REQUIRED'
# command = [
# 'uv',
# 'run',
# '--script',
# 'tools/linter/adapters/cmake_minimum_required_linter.py',
# '--',
# '@{{PATHSFILE}}'
# ]
# include_patterns = [
# "**/pyproject.toml",
# "**/CMakeLists.txt",
# "**/CMakeLists.txt.in",
# "**/*.cmake",
# "**/*.cmake.in",
# "**/*requirements*.txt",
# "**/*requirements*.in",
# ]
# [[linter]]
# code = 'COPYRIGHT'
# include_patterns = ['**']
# exclude_patterns = [
# '.lintrunner.toml',
# 'fb/**',
# '**/fb/**',
# ]
# command = [
# 'python3',
# 'tools/linter/adapters/grep_linter.py',
# '--pattern=Confidential and proprietary',
# '--linter-name=COPYRIGHT',
# '--error-name=Confidential Code',
# """--error-description=\
# Proprietary and confidential source code\
# should not be contributed to PyTorch codebase\
# """,
# '--',
# '@{{PATHSFILE}}'
# ]
# [[linter]]
# code = 'BAZEL_LINTER'
# include_patterns = ['WORKSPACE']
# command = [
# 'python3',
# 'tools/linter/adapters/bazel_linter.py',
# '--binary=.lintbin/bazel',
# '--',
# '@{{PATHSFILE}}'
# ]
# init_command = [
# 'python3',
# 'tools/linter/adapters/s3_init.py',
# '--config-json=tools/linter/adapters/s3_init_config.json',
# '--linter=bazel',
# '--dry-run={{DRYRUN}}',
# '--output-dir=.lintbin',
# '--output-name=bazel',
# ]
# is_formatter = true
# [[linter]]
# code = 'LINTRUNNER_VERSION'
# include_patterns = ['**']
# exclude_patterns = [
# 'fb/**',
# '**/fb/**',
# ]
# command = [
# 'python3',
# 'tools/linter/adapters/lintrunner_version_linter.py'
# ]
# [[linter]]
# code = 'RUFF'
# include_patterns = [
# '**/*.py',
# '**/*.pyi',
# '**/*.ipynb',
# 'pyproject.toml',
# ]
# exclude_patterns = [
# 'caffe2/**',
# 'functorch/docs/**',
# 'torch_npu/_inductor/fx_passes/serialized_patterns/**',
# 'torch_npu/_inductor/autoheuristic/artifacts/**',
# 'torch_npu/_inductor/kernel/vendored_templates/cutedsl/kernels/**',
# 'torch_npu/_inductor/kernel/vendored_templates/cutedsl/dense_blockscaled_gemm_persistent.py',
# 'test/dynamo/cpython/**',
# 'test/test_torchfuzz_repros.py',
# 'test/npu/test_fault_mode.py',
# 'torch_npu/utils/_dynamo.py',
# 'test/npu/test_resnet.py',
# 'test/npu/test_public_bindings.py',
# 'test/npu/test_compatibility.py',
# 'scripts/**',
# 'third_party/**',
# 'fb/**',
# '**/fb/**',
# # NPUGraph logs files
# 'torch_npu/_logging/_internal.py',
# 'torch_npu/npu/_graph_tree.py',
# 'torch_npu/npu/graphs.py',
# 'torch_npu/utils/_graph_tree.py',
# ]
# command = [
# 'uv',
# 'run',
# '--script',
# 'tools/linter/adapters/ruff_linter.py',
# '--config=pyproject.toml',
# '--show-disable',
# '--',
# '@{{PATHSFILE}}'
# ]
# is_formatter = true
# # This linter prevents merge conflicts in csv files in pytorch by enforcing
# # three lines of whitespace between entries such that unless people are modifying
# # the same line, merge conflicts should not arise in git or hg
# [[linter]]
# code = 'MERGE_CONFLICTLESS_CSV'
# include_patterns = [
# 'benchmarks/dynamo/ci_expected_accuracy/*.csv',
# 'benchmarks/dynamo/pr_time_benchmarks/expected_results.csv',
# ]
# command = [
# 'python3',
# 'tools/linter/adapters/no_merge_conflict_csv_linter.py',
# '--',
# '@{{PATHSFILE}}'
# ]
# is_formatter = true
# [[linter]]
# code = 'META_NO_CREATE_UNBACKED'
# include_patterns = [
# "torch_npu/_meta_registrations.py"
# ]
# command = [
# 'python3',
# 'tools/linter/adapters/grep_linter.py',
# '--pattern=create_unbacked',
# '--linter-name=META_NO_CREATE_UNBACKED',
# '--error-name=no create_unbacked in meta registrations',
# """--error-description=\
# Data-dependent operators should have their meta \
# registration in torch_npu/_subclasses/fake_impls.py, \
# not torch_npu/_meta_registrations.py
# """,
# '--',
# '@{{PATHSFILE}}'
# ]
# [[linter]]
# code = 'ATEN_CPU_GPU_AGNOSTIC'
# include_patterns = [
# # aten source
# "aten/src/ATen/*.cpp",
# "aten/src/ATen/cpu/*.cpp",
# "aten/src/ATen/functorch/**/*.cpp",
# "aten/src/ATen/nnapi/*.cpp",
# "aten/src/ATen/quantized/*.cpp",
# "aten/src/ATen/vulkan/*.cpp",
# "aten/src/ATen/metal/*.cpp",
# "aten/src/ATen/detail/CPUGuardImpl.cpp",
# "aten/src/ATen/detail/MetaGuardImpl.cpp",
# # aten native source
# "aten/src/ATen/native/cpu/*.cpp",
# "aten/src/ATen/native/ao_sparse/cpu/kernels/*.cpp",
# "aten/src/ATen/native/ao_sparse/quantized/cpu/kernels/*.cpp",
# "aten/src/ATen/native/quantized/cpu/kernels/*.cpp",
# "aten/src/ATen/native/*.cpp",
# "aten/src/ATen/native/cpu/**/*.cpp",
# "aten/src/ATen/native/ao_sparse/*.cpp",
# "aten/src/ATen/native/ao_sparse/**/*.cpp",
# "aten/src/ATen/native/ao_sparse/quantized/*.cpp",
# "aten/src/ATen/native/ao_sparse/quantized/**/*.cpp",
# "aten/src/ATen/native/nested/*.cpp",
# "aten/src/ATen/native/quantized/*.cpp",
# "aten/src/ATen/native/quantized/**/*.cpp",
# "aten/src/ATen/native/sparse/*.cpp",
# "aten/src/ATen/native/transformers/*.cpp",
# "aten/src/ATen/native/utils/*.cpp",
# "aten/src/ATen/native/xnnpack/*.cpp",
# "aten/src/ATen/native/metal/MetalPrepackOpRegister.cpp",
# # aten headers
# "aten/src/ATen/*.h",
# "aten/src/ATen/functorch/**/*.h",
# "aten/src/ATen/ops/*.h",
# "aten/src/ATen/cpu/**/*.h",
# "aten/src/ATen/nnapi/*.h",
# "aten/src/ATen/quantized/*.h",
# "aten/src/ATen/vulkan/*.h",
# "aten/src/ATen/metal/*.h",
# "aten/src/ATen/mps/*.h",
# # aten native headers
# "aten/src/ATen/native/*.h",
# "aten/src/ATen/native/cpu/**/*.h",
# "aten/src/ATen/native/nested/*.h",
# "aten/src/ATen/native/sparse/*.h",
# "aten/src/ATen/native/ao_sparse/*.h",
# "aten/src/ATen/native/ao_sparse/cpu/*.h",
# "aten/src/ATen/native/ao_sparse/quantized/*.h",
# "aten/src/ATen/native/ao_sparse/quantized/cpu/*.h",
# "aten/src/ATen/native/quantized/*.h",
# "aten/src/ATen/native/quantized/cpu/*.h",
# "aten/src/ATen/native/transformers/*.h",
# "aten/src/ATen/native/quantized/cpu/qnnpack/include/*.h",
# "aten/src/ATen/native/utils/*.h",
# "aten/src/ATen/native/vulkan/ops/*.h",
# "aten/src/ATen/native/xnnpack/*.h",
# "aten/src/ATen/native/metal/MetalPrepackOpContext.h",
# "aten/src/ATen/native/mps/Copy.h",
# "aten/src/ATen/native/mkldnn/**/*.h",
# ]
# exclude_patterns = [
# "aten/src/ATen/Context.h",
# "aten/src/ATen/Context.cpp",
# "aten/src/ATen/DLConvertor.cpp",
# "aten/src/ATen/core/Array.h",
# "aten/src/ATen/native/quantized/ConvUtils.h",
# "aten/src/ATen/native/sparse/SparseBlasImpl.cpp", # triton implementation
# "aten/src/ATen/native/transformers/attention.cpp",
# "aten/src/ATen/native/**/cudnn/**", # cudnn is cuda specific
# ]
# command = [
# 'python3',
# 'tools/linter/adapters/grep_linter.py',
# '--pattern=(^#if.*USE_ROCM.*)|(^#if.*USE_CUDA.*)',
# '--linter-name=ATEN_CPU',
# '--error-name=aten-cpu should be gpu agnostic',
# """--error-description=\
# We strongly discourage the compile-time divergence \
# on ATen-CPU code for different GPU code. This \
# disallows sharing the same aten-cpu shared object \
# between different GPU backends \
# """,
# '--',
# '@{{PATHSFILE}}'
# ]
# is_formatter = true
# # `set_linter` detects occurrences of built-in `set` in areas of Python code like
# # _inductor where the instability of iteration in `set` has proven a problem.
# [[linter]]
# code = 'SET_LINTER'
# command = [
# 'python3',
# 'tools/linter/adapters/set_linter.py',
# '--lintrunner',
# '--',
# '@{{PATHSFILE}}'
# ]
# include_patterns = [
# "torch_npu/_inductor/**/*.py",
# "torch_npu/_functorch/partitioners.py",
# ]
# is_formatter = true
# # `docstring_linter` reports on long Python classes, methods, and functions
# # whose definitions have very small docstrings or none at all.
# #
# [[linter]]
# code = 'DOCSTRING_LINTER'
# command = [
# 'python3',
# 'tools/linter/adapters/docstring_linter.py',
# '--lintrunner',
# '--',
# '@{{PATHSFILE}}'
# ]
# include_patterns = [
# 'torch_npu/_inductor/**/*.py'
# ]
# exclude_patterns = [
# 'torch_npu/_inductor/kernel/vendored_templates/cutedsl/kernels/**',
# 'torch_npu/_inductor/kernel/vendored_templates/cutedsl/dense_blockscaled_gemm_persistent.py',
# ]
# is_formatter = false
# # `import_linter` reports on importing disallowed third party libraries.
# [[linter]]
# code = 'IMPORT_LINTER'
# command = [
# 'python3',
# 'tools/linter/adapters/import_linter.py',
# '--',
# '@{{PATHSFILE}}'
# ]
# include_patterns = [
# 'torch_npu/_dynamo/**',
# ]
# is_formatter = false
# [[linter]]
# code = 'TEST_DEVICE_BIAS'
# command = [
# 'python3',
# 'tools/linter/adapters/test_device_bias_linter.py',
# '--',
# '@{{PATHSFILE}}',
# ]
# include_patterns = [
# 'test/**/test_*.py',
# ]
# exclude_patterns = [
# # CPython tests
# 'test/dynamo/cpython/**',
# ]
# # 'header_only_linter' reports on properly testing header-only APIs.
# [[linter]]
# code = 'HEADER_ONLY_LINTER'
# command = [
# 'python3',
# 'tools/linter/adapters/header_only_linter.py',
# ]
# include_patterns = [
# 'torch_npu/header_only_apis.txt',
# ]
# is_formatter = false
# [[linter]]
# code = "GB_REGISTRY"
# include_patterns = ["torch_npu/_dynamo/**/*.py"]
# command = [
# "python3",
# "tools/linter/adapters/gb_registry_linter.py",
# ]
# [[linter]]
# code = 'STABLE_SHIM_VERSION'
# include_patterns = [
# 'torch_npu/csrc/stable/c/shim.h',
# 'torch_npu/csrc/inductor/aoti_torch/c/shim.h'
# ]
# command = [
# 'python3',
# 'tools/linter/adapters/stable_shim_version_linter.py',
# '--',
# '@{{PATHSFILE}}'
# ]
# [[linter]]
# code = 'STABLE_SHIM_USAGE'
# include_patterns = [
# 'torch_npu/csrc/stable/**/*.h',
# ]
# command = [
# 'python3',
# 'tools/linter/adapters/stable_shim_usage_linter.py',
# '--',
# '@{{PATHSFILE}}'
# ]