mirror of
https://github.com/pytorch/pytorch.git
synced 2026-11-20 08:14:28 +08:00
[Testcase Refactoring] Classify test/autograd/test_complex.py for the test-case linter (#205448)
> **Agent details / AI-generated content.** This PR and its description were > produced end-to-end by an AI coding agent (DeepSeek Harness); the submitting > user reviewed the exact diff and this description before submission and takes > responsibility for it. The change strictly follows the newly introduced > test-case linter (`tools/linter/adapters/test_linter.py`) and `test/REVIEW.md`. ## Summary `TestAutogradComplex` did not declare a hardware classification, so the newly introduced test-case linter flagged the file. The class exercises autograd view/complex-number logic on device-agnostic tensors: its tests take no `device` parameter and the class is not instantiated with `instantiate_device_type_tests`, so it is `GENERIC`. ## Changes Declared `hw_classification = HardwareClassification.GENERIC` and imported `HardwareClassification`. No test was modified, moved or removed. ## Coverage No coverage change: the same two tests run as before. ## Test Plan ```bash python tools/linter/adapters/test_linter.py test/autograd/test_complex.py lintrunner test/autograd/test_complex.py python test/autograd/test_complex.py -v ``` Linter and lintrunner clean; 2 tests passed. _Authored with assistance of my agent._ Pull Request resolved: https://github.com/pytorch/pytorch/pull/205448 Approved by: https://github.com/fffrog
This commit is contained in:
committed by
PyTorch MergeBot
parent
2c719af448
commit
e81dae8fe4
@@ -1,10 +1,17 @@
|
|||||||
# Owner(s): ["module: autograd"]
|
# Owner(s): ["module: autograd"]
|
||||||
|
|
||||||
import torch
|
import torch
|
||||||
from torch.testing._internal.common_utils import gradcheck, run_tests, TestCase
|
from torch.testing._internal.common_utils import (
|
||||||
|
gradcheck,
|
||||||
|
HardwareClassification,
|
||||||
|
run_tests,
|
||||||
|
TestCase,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class TestAutogradComplex(TestCase):
|
class TestAutogradComplex(TestCase):
|
||||||
|
hw_classification = HardwareClassification.GENERIC
|
||||||
|
|
||||||
def test_view_func_for_complex_views(self):
|
def test_view_func_for_complex_views(self):
|
||||||
# case 1: both parent and child have view_func
|
# case 1: both parent and child have view_func
|
||||||
x = torch.randn(2, 2, 2, dtype=torch.double, requires_grad=True)
|
x = torch.randn(2, 2, 2, dtype=torch.double, requires_grad=True)
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
"test/ao/sparsity/test_composability.py",
|
"test/ao/sparsity/test_composability.py",
|
||||||
"test/ao/sparsity/test_sparsifier.py",
|
"test/ao/sparsity/test_sparsifier.py",
|
||||||
"test/ao/sparsity/test_structured_sparsifier.py",
|
"test/ao/sparsity/test_structured_sparsifier.py",
|
||||||
"test/autograd/test_complex.py",
|
|
||||||
"test/benchmark_utils/test_benchmark_utils.py",
|
"test/benchmark_utils/test_benchmark_utils.py",
|
||||||
"test/cpp_extensions/libtorch_agn_2_10_extension/test_version_compatibility.py",
|
"test/cpp_extensions/libtorch_agn_2_10_extension/test_version_compatibility.py",
|
||||||
"test/cpp_extensions/python_agnostic_extension/test/test_python_agnostic.py",
|
"test/cpp_extensions/python_agnostic_extension/test/test_python_agnostic.py",
|
||||||
|
|||||||
Reference in New Issue
Block a user