mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
[BE][Easy][9/19] enforce style for empty lines in import segments in test/[e-h]*/
(#129760)
See https://github.com/pytorch/pytorch/pull/129751#issue-2380881501. Most changes are auto-generated by linter. You can review these PRs via: ```bash git diff --ignore-all-space --ignore-blank-lines HEAD~1 ``` Pull Request resolved: https://github.com/pytorch/pytorch/pull/129760 Approved by: https://github.com/ezyang
This commit is contained in:
committed by
PyTorch MergeBot
parent
cbf274d4a7
commit
76169cf691
@ -12,6 +12,7 @@ from torch.testing._internal.common_methods_invocations import op_db
|
||||
from torch.testing._internal.common_utils import TestCase
|
||||
from torch.utils._pytree import tree_map
|
||||
|
||||
|
||||
# Simplified naming for C++ classes
|
||||
SchemaArgument = torch._C._SchemaArgument
|
||||
SchemaArgType = torch._C._SchemaArgType
|
||||
|
@ -5,14 +5,13 @@ from collections import OrderedDict
|
||||
from typing import Dict, List, Tuple, Union
|
||||
|
||||
import torch
|
||||
|
||||
import torch.utils._pytree as pytree
|
||||
|
||||
from torch._dynamo.test_case import TestCase
|
||||
from torch._export.converter import TS2EPConverter
|
||||
from torch.export import ExportedProgram
|
||||
from torch.testing._internal.common_utils import run_tests
|
||||
|
||||
|
||||
requires_cuda = unittest.skipUnless(torch.cuda.is_available(), "requires cuda")
|
||||
|
||||
|
||||
|
@ -1,18 +1,15 @@
|
||||
# Owner(s): ["oncall: export"]
|
||||
# flake8: noqa
|
||||
import unittest
|
||||
|
||||
from typing import Dict, List, Tuple
|
||||
|
||||
import torch
|
||||
import torch._dynamo
|
||||
from torch._dynamo.test_case import run_tests, TestCase
|
||||
from torch._export.wrappers import _mark_strict_experimental
|
||||
|
||||
from torch._functorch.aot_autograd import aot_export_module
|
||||
from torch.export._trace import _convert_ts_to_export_experimental
|
||||
from torch.export.experimental import _export_forward_backward
|
||||
|
||||
from torch.testing import FileCheck
|
||||
|
||||
|
||||
|
@ -16,7 +16,6 @@ from typing import Dict, List
|
||||
import torch
|
||||
import torch._dynamo as torchdynamo
|
||||
import torch.nn.functional as F
|
||||
|
||||
from functorch.experimental.control_flow import cond, map
|
||||
from torch import Tensor
|
||||
from torch._dynamo.test_case import TestCase
|
||||
@ -61,6 +60,7 @@ from torch.utils._pytree import (
|
||||
treespec_loads,
|
||||
)
|
||||
|
||||
|
||||
try:
|
||||
from torchrec.sparse.jagged_tensor import KeyedJaggedTensor
|
||||
|
||||
|
@ -5,8 +5,10 @@ try:
|
||||
except ImportError:
|
||||
import test_export
|
||||
import testing
|
||||
|
||||
from torch.export import export
|
||||
|
||||
|
||||
test_classes = {}
|
||||
|
||||
|
||||
|
@ -5,8 +5,10 @@ try:
|
||||
except ImportError:
|
||||
import test_export
|
||||
import testing
|
||||
|
||||
from torch.export._trace import _export_for_training
|
||||
|
||||
|
||||
test_classes = {}
|
||||
|
||||
|
||||
|
@ -24,6 +24,7 @@ from torch.testing._internal.hop_db import (
|
||||
hop_that_doesnt_have_opinfo_test_allowlist,
|
||||
)
|
||||
|
||||
|
||||
hop_tests = []
|
||||
|
||||
for op_info in hop_db:
|
||||
|
@ -16,7 +16,6 @@ from torch.export.exported_program import (
|
||||
OutputSpec,
|
||||
TensorArgument,
|
||||
)
|
||||
|
||||
from torch.export.graph_signature import CustomObjArgument
|
||||
from torch.testing._internal.common_utils import (
|
||||
find_library_location,
|
||||
|
@ -3,7 +3,6 @@ import copy
|
||||
import unittest
|
||||
|
||||
import torch
|
||||
|
||||
from functorch.experimental import control_flow
|
||||
from torch._dynamo.eval_frame import is_dynamo_supported
|
||||
from torch._export.pass_base import _ExportPassBaseDeprecatedDoNotUse
|
||||
|
@ -11,7 +11,6 @@ from re import escape
|
||||
from typing import List, Set
|
||||
|
||||
import torch
|
||||
|
||||
from functorch.experimental.control_flow import cond
|
||||
from torch._dynamo.eval_frame import is_dynamo_supported
|
||||
from torch._export.non_strict_utils import (
|
||||
|
@ -5,8 +5,10 @@ try:
|
||||
except ImportError:
|
||||
import test_export
|
||||
import testing
|
||||
|
||||
from torch.export import export
|
||||
|
||||
|
||||
test_classes = {}
|
||||
|
||||
|
||||
|
@ -6,7 +6,6 @@ from torch._export.serde.schema_check import (
|
||||
SchemaUpdateError,
|
||||
update_schema,
|
||||
)
|
||||
|
||||
from torch.testing._internal.common_utils import IS_FBCODE, run_tests, TestCase
|
||||
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
import io
|
||||
|
||||
|
||||
try:
|
||||
from . import test_export, testing
|
||||
except ImportError:
|
||||
@ -10,6 +11,7 @@ except ImportError:
|
||||
|
||||
from torch.export import export, load, save
|
||||
|
||||
|
||||
test_classes = {}
|
||||
|
||||
|
||||
|
@ -7,7 +7,6 @@ import sys
|
||||
import unittest
|
||||
|
||||
import torch
|
||||
|
||||
from torch._subclasses.fake_tensor import FakeTensor
|
||||
from torch.testing._internal.common_utils import (
|
||||
instantiate_parametrized_tests,
|
||||
@ -17,6 +16,7 @@ from torch.testing._internal.common_utils import (
|
||||
TestCase,
|
||||
)
|
||||
|
||||
|
||||
# Various data types (preserved over operations).
|
||||
DTYPES = [
|
||||
torch.int64,
|
||||
|
@ -3,9 +3,9 @@
|
||||
import torch
|
||||
from torch._dynamo.test_case import TestCase
|
||||
from torch._export.tools import report_exportability
|
||||
|
||||
from torch.testing._internal.common_utils import run_tests
|
||||
|
||||
|
||||
torch.library.define(
|
||||
"testlib::op_missing_meta",
|
||||
"(Tensor(a!) x, Tensor(b!) z) -> Tensor",
|
||||
|
@ -8,7 +8,6 @@ import torch.utils._pytree as pytree
|
||||
from torch._dynamo.testing import EagerAndRecordGraphs
|
||||
from torch._functorch.aot_autograd import aot_export_module
|
||||
from torch._higher_order_ops.torchbind import enable_torchbind_tracing
|
||||
|
||||
from torch._higher_order_ops.wrap import wrap
|
||||
from torch._library.fake_class_registry import FakeScriptObject
|
||||
from torch.export import export
|
||||
|
@ -3,7 +3,6 @@ from collections import OrderedDict
|
||||
|
||||
import torch
|
||||
from torch._dynamo.test_case import TestCase
|
||||
|
||||
from torch.export._tree_utils import is_equivalent, reorder_kwargs
|
||||
from torch.testing._internal.common_utils import run_tests
|
||||
from torch.utils._pytree import tree_structure
|
||||
|
@ -10,7 +10,6 @@ from typing import Any, List
|
||||
|
||||
import torch
|
||||
import torch._dynamo as torchdynamo
|
||||
|
||||
from functorch.experimental.control_flow import cond, map
|
||||
from torch import Tensor
|
||||
from torch._export.utils import (
|
||||
@ -42,7 +41,6 @@ from torch.testing._internal.common_utils import (
|
||||
skipIfTorchDynamo,
|
||||
TestCase,
|
||||
)
|
||||
|
||||
from torch.testing._internal.torchbind_impls import init_torchbind_implementations
|
||||
from torch.utils._pytree import (
|
||||
LeafSpec,
|
||||
|
@ -2,11 +2,9 @@
|
||||
import unittest
|
||||
|
||||
import torch
|
||||
|
||||
from functorch.experimental import control_flow
|
||||
from torch import Tensor
|
||||
from torch._dynamo.eval_frame import is_dynamo_supported
|
||||
|
||||
from torch._export.verifier import SpecViolationError, Verifier
|
||||
from torch.export import export
|
||||
from torch.export.exported_program import InputKind, InputSpec, TensorArgument
|
||||
|
@ -4,6 +4,7 @@ from unittest.mock import patch
|
||||
|
||||
import torch
|
||||
|
||||
|
||||
aten = torch.ops.aten
|
||||
|
||||
# This list is not meant to be comprehensive
|
||||
|
@ -6,7 +6,6 @@
|
||||
import math
|
||||
|
||||
import torch
|
||||
|
||||
from functorch.dim import cat, dimlists, dims, softmax
|
||||
from torch import nn
|
||||
|
||||
|
@ -13,13 +13,13 @@ from functorch_additional_op_db import additional_op_db
|
||||
|
||||
import torch
|
||||
import torch.utils._pytree as pytree
|
||||
|
||||
from functorch import vmap
|
||||
from torch.testing._internal.autograd_function_db import autograd_function_db
|
||||
from torch.testing._internal.common_device_type import toleranceOverride
|
||||
from torch.testing._internal.common_methods_invocations import DecorateInfo, op_db
|
||||
from torch.testing._internal.common_modules import module_db
|
||||
|
||||
|
||||
IS_FBCODE = os.getenv("FUNCTORCH_TEST_FBCODE") == "1"
|
||||
|
||||
|
||||
|
@ -6,6 +6,7 @@ from enum import Enum
|
||||
|
||||
# Importing these files make modifications to the op_db that we need
|
||||
import test_ops # noqa: F401
|
||||
|
||||
import test_vmap # noqa: F401
|
||||
from functorch_additional_op_db import additional_op_db
|
||||
|
||||
@ -14,6 +15,7 @@ import torch._functorch.top_operators_github_usage as top_ops
|
||||
from torch.testing._internal.common_device_type import toleranceOverride
|
||||
from torch.testing._internal.common_methods_invocations import op_db
|
||||
|
||||
|
||||
all_overridable = list(torch.overrides.get_testing_overrides().keys())
|
||||
|
||||
public_docs = [
|
||||
|
@ -3,7 +3,6 @@ import unittest
|
||||
from functools import partial
|
||||
|
||||
import torch
|
||||
|
||||
from torch.testing._internal.common_dtype import (
|
||||
all_types_and_complex_and,
|
||||
floating_types,
|
||||
@ -16,6 +15,7 @@ from torch.testing._internal.common_methods_invocations import (
|
||||
)
|
||||
from torch.testing._internal.common_utils import make_tensor
|
||||
|
||||
|
||||
# List of OpInfos that aren't in PyTorch Core yet.
|
||||
# They are here because we wanted a fast way of writing OpInfos and may not be
|
||||
# 100% correct (w.r.t. to dtypes and other options).
|
||||
|
@ -80,6 +80,7 @@ from torch.testing._internal.optests import (
|
||||
)
|
||||
from torch.testing._internal.two_tensor import TwoTensor, TwoTensorMode
|
||||
|
||||
|
||||
USE_TORCHVISION = False
|
||||
try:
|
||||
import torchvision
|
||||
|
@ -5,7 +5,6 @@ import unittest
|
||||
|
||||
import torch
|
||||
import torch.utils._pytree as pytree
|
||||
|
||||
from functorch.experimental import control_flow
|
||||
from functorch.experimental.control_flow import cond, UnsupportedAliasMutationException
|
||||
from torch._higher_order_ops.while_loop import while_loop
|
||||
@ -17,7 +16,6 @@ from torch._subclasses.functional_tensor import (
|
||||
)
|
||||
from torch.fx.experimental.proxy_tensor import make_fx
|
||||
from torch.testing._internal.common_quantization import skipIfNoDynamoSupport
|
||||
|
||||
from torch.testing._internal.common_utils import (
|
||||
instantiate_parametrized_tests,
|
||||
IS_WINDOWS,
|
||||
|
@ -6,14 +6,12 @@
|
||||
# This source code is licensed under the BSD-style license found in the
|
||||
# LICENSE file in the root directory of this source tree.
|
||||
import gc
|
||||
|
||||
from unittest import skip, skipIf
|
||||
|
||||
from attn_ft import BertSelfAttention as BertSelfAttentionA, Linear
|
||||
from attn_positional import BertSelfAttention as BertSelfAttentionB
|
||||
|
||||
import torch
|
||||
|
||||
from functorch._C import dim as _C
|
||||
from functorch.dim import (
|
||||
Dim,
|
||||
@ -24,7 +22,6 @@ from functorch.dim import (
|
||||
stack,
|
||||
Tensor,
|
||||
)
|
||||
|
||||
from torch.testing._internal.common_utils import (
|
||||
run_tests,
|
||||
skipIfTorchDynamo,
|
||||
@ -32,6 +29,7 @@ from torch.testing._internal.common_utils import (
|
||||
TestCase,
|
||||
)
|
||||
|
||||
|
||||
try:
|
||||
from torchvision.models import resnet18
|
||||
except ImportError:
|
||||
@ -46,6 +44,7 @@ _test_c, _parse_test, _set_pointwise_optimize = (
|
||||
from contextlib import contextmanager
|
||||
from time import perf_counter
|
||||
|
||||
|
||||
measure_perf = False
|
||||
if measure_perf:
|
||||
from torchdim.magic_trace import magic_trace
|
||||
|
@ -79,9 +79,9 @@ from torch.testing._internal.common_utils import (
|
||||
TestCase,
|
||||
xfailIfTorchDynamo,
|
||||
)
|
||||
|
||||
from torch.utils._pytree import tree_flatten, tree_map, tree_unflatten
|
||||
|
||||
|
||||
USE_TORCHVISION = False
|
||||
try:
|
||||
import torchvision # noqa: F401
|
||||
|
@ -8,13 +8,13 @@ from typing import Callable
|
||||
import torch
|
||||
import torch.fx as fx
|
||||
import torch.nn as nn
|
||||
|
||||
from functorch import make_fx
|
||||
from functorch.compile import memory_efficient_fusion
|
||||
from torch._functorch.compile_utils import fx_graph_cse
|
||||
from torch.nn import functional as F
|
||||
from torch.testing._internal.common_utils import run_tests, TestCase
|
||||
|
||||
|
||||
HAS_CUDA = torch.cuda.is_available()
|
||||
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
# Owner(s): ["module: functorch"]
|
||||
|
||||
import torch
|
||||
|
||||
from functorch import make_fx
|
||||
from functorch.compile import minifier
|
||||
from torch._functorch.compile_utils import get_outputs, get_placeholders
|
||||
|
@ -31,7 +31,6 @@ from functorch_additional_op_db import additional_op_db
|
||||
|
||||
import torch
|
||||
import torch.autograd.forward_ad as fwAD
|
||||
|
||||
from functorch import grad, jacfwd, jacrev, vjp, vmap
|
||||
from torch import Tensor
|
||||
from torch._functorch.eager_transforms import _as_tuple, jvp
|
||||
@ -44,7 +43,6 @@ from torch.testing._internal.common_device_type import (
|
||||
toleranceOverride,
|
||||
)
|
||||
from torch.testing._internal.common_methods_invocations import op_db
|
||||
|
||||
from torch.testing._internal.common_utils import (
|
||||
is_iterable_of_tensors,
|
||||
IS_MACOS,
|
||||
@ -59,11 +57,11 @@ from torch.testing._internal.common_utils import (
|
||||
TestCase,
|
||||
unMarkDynamoStrictTest,
|
||||
)
|
||||
|
||||
from torch.testing._internal.opinfo.core import SampleInput
|
||||
from torch.utils import _pytree as pytree
|
||||
from torch.utils._pytree import tree_flatten, tree_map, tree_unflatten
|
||||
|
||||
|
||||
aten = torch.ops.aten
|
||||
|
||||
|
||||
|
@ -34,9 +34,9 @@ from functorch.einops._parsing import (
|
||||
ParsedExpression,
|
||||
validate_rearrange_expressions,
|
||||
)
|
||||
|
||||
from torch.testing._internal.common_utils import run_tests, TestCase
|
||||
|
||||
|
||||
mock_anonymous_axis_eq: Callable[[AnonymousAxis, object], bool] = (
|
||||
lambda self, other: isinstance(other, AnonymousAxis) and self.value == other.value
|
||||
)
|
||||
|
@ -30,10 +30,10 @@ from typing import List, Tuple
|
||||
import numpy as np
|
||||
|
||||
import torch
|
||||
|
||||
from functorch.einops import rearrange
|
||||
from torch.testing._internal.common_utils import run_tests, TestCase
|
||||
|
||||
|
||||
identity_patterns: List[str] = [
|
||||
"...->...",
|
||||
"a b c d e-> a b c d e",
|
||||
|
@ -36,7 +36,6 @@ from common_utils import (
|
||||
from functorch_additional_op_db import additional_op_db
|
||||
|
||||
import functorch
|
||||
|
||||
import torch
|
||||
import torch.nn.functional as F
|
||||
from functorch import grad, grad_and_value, jacfwd, jvp, vjp, vmap
|
||||
@ -71,6 +70,7 @@ from torch.testing._internal.common_utils import (
|
||||
)
|
||||
from torch.utils import _pytree as pytree
|
||||
|
||||
|
||||
FALLBACK_REGEX = "There is a performance drop"
|
||||
|
||||
|
||||
|
@ -5,7 +5,6 @@ import unittest
|
||||
from torch._C import (
|
||||
_dispatch_get_registrations_for_dispatch_key as get_registrations_for_dispatch_key,
|
||||
)
|
||||
|
||||
from torch.testing._internal.common_utils import (
|
||||
instantiate_parametrized_tests,
|
||||
parametrize,
|
||||
@ -14,6 +13,7 @@ from torch.testing._internal.common_utils import (
|
||||
TestCase,
|
||||
)
|
||||
|
||||
|
||||
xfail_functorch_batched = {
|
||||
"aten::is_nonzero",
|
||||
"aten::item",
|
||||
|
@ -2,6 +2,7 @@ import re
|
||||
|
||||
import torch
|
||||
|
||||
|
||||
"""
|
||||
Instructions:
|
||||
|
||||
|
@ -12,6 +12,7 @@ from torch.fx.graph import map_arg
|
||||
from torch.fx.proxy import Proxy
|
||||
from torch.nn.utils import fuse_conv_bn_weights
|
||||
|
||||
|
||||
# can be a
|
||||
# module type, a builtin function, or a string to match target
|
||||
|
||||
|
@ -6,7 +6,6 @@ import torch
|
||||
from torch.fx.experimental.proxy_tensor import make_fx
|
||||
from torch.fx.graph_module import GraphModule
|
||||
from torch.fx.passes.dialect.common.cse_pass import CSEPass
|
||||
|
||||
from torch.testing._internal.common_utils import (
|
||||
instantiate_parametrized_tests,
|
||||
parametrize,
|
||||
|
@ -6,7 +6,6 @@ import torch
|
||||
from torch.fx import symbolic_trace
|
||||
from torch.fx.experimental.proxy_tensor import make_fx
|
||||
from torch.fx.passes.dialect.common.cse_pass import CSEPass, get_CSE_banned_ops
|
||||
|
||||
from torch.testing._internal.common_utils import run_tests, TestCase
|
||||
|
||||
|
||||
|
@ -5,7 +5,6 @@ from typing import Set, Type
|
||||
|
||||
import torch
|
||||
import torch.fx
|
||||
|
||||
from torch.testing._internal.common_utils import TestCase
|
||||
|
||||
|
||||
|
@ -4,7 +4,6 @@ import unittest
|
||||
|
||||
import torch
|
||||
import torch.fx
|
||||
|
||||
from torch.testing._internal.common_utils import TestCase
|
||||
|
||||
|
||||
|
@ -5,7 +5,6 @@ from typing import Dict, List, Tuple
|
||||
|
||||
import torch
|
||||
from torch.fx.passes.split_utils import split_by_tags
|
||||
|
||||
from torch.testing._internal.common_utils import TestCase
|
||||
|
||||
|
||||
|
@ -6,7 +6,6 @@ import tempfile
|
||||
import torch
|
||||
from torch.fx import subgraph_rewriter, symbolic_trace
|
||||
from torch.fx.passes.graph_transform_observer import GraphTransformObserver
|
||||
|
||||
from torch.testing._internal.common_utils import TestCase
|
||||
|
||||
|
||||
|
@ -9,6 +9,7 @@ import torch.nn.functional as F
|
||||
from torch.fx import symbolic_trace
|
||||
from torch.fx.experimental.proxy_tensor import make_fx
|
||||
|
||||
|
||||
pytorch_test_dir = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
|
||||
sys.path.append(pytorch_test_dir)
|
||||
import unittest
|
||||
|
@ -1,7 +1,6 @@
|
||||
# Owner(s): ["module: fx"]
|
||||
|
||||
import unittest
|
||||
|
||||
from typing import Mapping
|
||||
|
||||
import torch
|
||||
|
@ -9,7 +9,6 @@ from torch.fx.passes.infra.pass_manager import (
|
||||
PassManager,
|
||||
this_before_that_pass_constraint,
|
||||
)
|
||||
|
||||
from torch.testing._internal.common_utils import TestCase
|
||||
|
||||
|
||||
|
@ -6,6 +6,7 @@ import unittest
|
||||
|
||||
import torch
|
||||
|
||||
|
||||
pytorch_test_dir = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
|
||||
sys.path.append(pytorch_test_dir)
|
||||
from torch._dynamo.eval_frame import is_dynamo_supported
|
||||
|
@ -10,10 +10,12 @@ from torch.fx.annotate import annotate
|
||||
# Make the helper files in test/ importable
|
||||
from torch.fx.experimental.rewriter import RewritingTracer
|
||||
|
||||
|
||||
pytorch_test_dir = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
|
||||
sys.path.append(pytorch_test_dir)
|
||||
from torch.testing._internal.jit_utils import JitTestCase
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise RuntimeError(
|
||||
"This test file is not meant to be run directly, use:\n\n"
|
||||
|
@ -23,7 +23,6 @@ from torch.testing._internal.common_utils import (
|
||||
TEST_WITH_ROCM,
|
||||
TestCase,
|
||||
)
|
||||
|
||||
from torch.testing._internal.torchbind_impls import init_torchbind_implementations
|
||||
from torch.utils.hooks import RemovableHandle # noqa: TCH001
|
||||
|
||||
|
@ -45,7 +45,6 @@ ISORT_WHITELIST = re.compile(
|
||||
# test/dy*/**
|
||||
"test/dy*/**",
|
||||
# test/[e-h]*/**
|
||||
"test/[e-h]*/**",
|
||||
# test/i*/**
|
||||
"test/i*/**",
|
||||
# test/j*/**
|
||||
|
Reference in New Issue
Block a user