mirror of
https://github.com/pytorch/pytorch.git
synced 2026-10-28 18:56:51 +08:00
## Summary This change adds `hw_classification = HardwareClassification.GENERIC` to `TestEqualizeFx` in `test/quantization/fx/test_equalize_fx.py`, allowing the class to be selected through the `--hw-classification` option. The class tests equalization observers and FX equalization transformations using CPU tensors. It has no CUDA-specific APIs, test device parameter, or `instantiate_device_type_tests` registration, so no device-decoupling changes or class split are needed. The four existing `skipIfNoFBGEMM` guards remain unchanged; `GENERIC` does not remove quantized-backend requirements. ## Changes - Add `HardwareClassification` to the existing import from `torch.testing._internal.common_utils`. - Add `hw_classification = HardwareClassification.GENERIC` to `TestEqualizeFx`. - Preserve all ten test methods, helper methods, assertions, tensor placement, and backend guards. No test methods are added or removed. ## Validation - **CPU:** With QNNPACK, the original and changed files each passed all ten test methods on aarch64 and x86_64, without skips. GENERIC selection of the changed class also passed all ten methods on both platforms. - **Default-engine baseline:** On x86_64, all ten methods passed before and after the change. The original aarch64 default `x86` engine run produced four FBGEMM errors; an after-change run with that default engine was not performed. - **CUDA classification:** All ten methods were excluded, and none executed. The Python 3.12 empty-suite run returned exit code 5; a separate verifier confirmed the expected exclusion. No CUDA computation was tested. - **Lint:** Target-file `spin lint` and `git diff --check` passed. The Windows lint wrapper skipped initialization of four linters whose include patterns do not match this file; the target-file checks were unchanged. - **Diff review:** All method bodies and decorators are unchanged. Removing the new import and class attribute from the parsed syntax tree reproduces the original module. - **Upstream CI:** Pending. The execution results above used PyTorch `2.13.0a0+git636bc91` with a separate validation-only backport of classification definitions and runner integration. That compatibility patch is excluded from this PR. Direct execution with the current upstream classification framework remains unverified. ## Risk Low. The change adds classification metadata while preserving the existing test logic, CPU execution, and backend guards. Pull Request resolved: https://github.com/pytorch/pytorch/pull/200575 Approved by: https://github.com/xuyun44, https://github.com/can-gaa-hou, https://github.com/fffrog