mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
[BE][Easy][1/19] enforce style for empty lines in import segments (#129752)
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/129752 Approved by: https://github.com/ezyang, https://github.com/malfet
This commit is contained in:
committed by
PyTorch MergeBot
parent
5e617d7ef5
commit
a3abfa5cb5
@ -5,6 +5,7 @@ import sys
|
|||||||
|
|
||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
|
|
||||||
# Need to import modules that lie on an upward-relative path
|
# Need to import modules that lie on an upward-relative path
|
||||||
sys.path.append(os.path.join(sys.path[0], ".."))
|
sys.path.append(os.path.join(sys.path[0], ".."))
|
||||||
|
|
||||||
|
@ -8,6 +8,7 @@ import time
|
|||||||
|
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
|
|
||||||
AZURE_PIPELINE_BASE_URL = "https://aiinfra.visualstudio.com/PyTorch/"
|
AZURE_PIPELINE_BASE_URL = "https://aiinfra.visualstudio.com/PyTorch/"
|
||||||
AZURE_DEVOPS_PAT_BASE64 = os.environ.get("AZURE_DEVOPS_PAT_BASE64_SECRET", "")
|
AZURE_DEVOPS_PAT_BASE64 = os.environ.get("AZURE_DEVOPS_PAT_BASE64_SECRET", "")
|
||||||
PIPELINE_ID = "911"
|
PIPELINE_ID = "911"
|
||||||
|
@ -3,6 +3,7 @@ from typing import Dict, List, Optional, Tuple
|
|||||||
import torch
|
import torch
|
||||||
from torch import Tensor
|
from torch import Tensor
|
||||||
|
|
||||||
|
|
||||||
OUTPUT_DIR = "src/androidTest/assets/"
|
OUTPUT_DIR = "src/androidTest/assets/"
|
||||||
|
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@ from torchvision import models
|
|||||||
|
|
||||||
import torch
|
import torch
|
||||||
|
|
||||||
|
|
||||||
print(torch.version.__version__)
|
print(torch.version.__version__)
|
||||||
|
|
||||||
resnet18 = models.resnet18(weights=models.ResNet18_Weights.IMAGENET1K_V1)
|
resnet18 = models.resnet18(weights=models.ResNet18_Weights.IMAGENET1K_V1)
|
||||||
|
@ -9,6 +9,7 @@ from torchvision import models
|
|||||||
|
|
||||||
import torch
|
import torch
|
||||||
|
|
||||||
|
|
||||||
# Download and trace the model.
|
# Download and trace the model.
|
||||||
model = models.mobilenet_v2(weights=models.MobileNet_V2_Weights.IMAGENET1K_V1)
|
model = models.mobilenet_v2(weights=models.MobileNet_V2_Weights.IMAGENET1K_V1)
|
||||||
model.eval()
|
model.eval()
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
import confu
|
import confu
|
||||||
|
|
||||||
|
|
||||||
parser = confu.standard_parser("clog configuration script")
|
parser = confu.standard_parser("clog configuration script")
|
||||||
|
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@ from dataclasses import dataclass
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import List, Optional
|
from typing import List, Optional
|
||||||
|
|
||||||
|
|
||||||
DTYPE_MAP = {
|
DTYPE_MAP = {
|
||||||
"fp16": "cutlass::half_t",
|
"fp16": "cutlass::half_t",
|
||||||
"bf16": "cutlass::bfloat16_t",
|
"bf16": "cutlass::bfloat16_t",
|
||||||
|
@ -15,6 +15,7 @@ from dataclasses import dataclass, field
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Dict, List, Optional, Tuple, TypeVar
|
from typing import Dict, List, Optional, Tuple, TypeVar
|
||||||
|
|
||||||
|
|
||||||
DTYPES = {
|
DTYPES = {
|
||||||
"f32": "float",
|
"f32": "float",
|
||||||
"f16": "cutlass::half_t",
|
"f16": "cutlass::half_t",
|
||||||
|
@ -18,11 +18,13 @@
|
|||||||
# NB: C++ API doc generation using doxygen / breathe / exhale is currently only
|
# NB: C++ API doc generation using doxygen / breathe / exhale is currently only
|
||||||
# enabled on nightlies (and not trunk or on PRs) due to OOM errors in CI.
|
# enabled on nightlies (and not trunk or on PRs) due to OOM errors in CI.
|
||||||
# See https://github.com/pytorch/pytorch/issues/79992.
|
# See https://github.com/pytorch/pytorch/issues/79992.
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
import textwrap
|
||||||
|
|
||||||
|
|
||||||
# sys.path.insert(0, os.path.abspath('.'))
|
# sys.path.insert(0, os.path.abspath('.'))
|
||||||
|
|
||||||
import textwrap
|
|
||||||
|
|
||||||
# -- General configuration ------------------------------------------------
|
# -- General configuration ------------------------------------------------
|
||||||
|
|
||||||
|
@ -24,9 +24,9 @@ from os import path
|
|||||||
|
|
||||||
# source code directory, relative to this file, for sphinx-autobuild
|
# source code directory, relative to this file, for sphinx-autobuild
|
||||||
# sys.path.insert(0, os.path.abspath('../..'))
|
# sys.path.insert(0, os.path.abspath('../..'))
|
||||||
|
|
||||||
import torch
|
import torch
|
||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import torchvision # noqa: F401
|
import torchvision # noqa: F401
|
||||||
except ImportError:
|
except ImportError:
|
||||||
@ -38,6 +38,7 @@ RELEASE = os.environ.get("RELEASE", False)
|
|||||||
|
|
||||||
import pytorch_sphinx_theme
|
import pytorch_sphinx_theme
|
||||||
|
|
||||||
|
|
||||||
# -- General configuration ------------------------------------------------
|
# -- General configuration ------------------------------------------------
|
||||||
|
|
||||||
# If your documentation needs a minimal Sphinx version, state it here.
|
# If your documentation needs a minimal Sphinx version, state it here.
|
||||||
@ -3475,6 +3476,7 @@ html_css_files = [
|
|||||||
|
|
||||||
from sphinx.ext.coverage import CoverageBuilder
|
from sphinx.ext.coverage import CoverageBuilder
|
||||||
|
|
||||||
|
|
||||||
# NB: Due to some duplications of the following modules/functions, we keep
|
# NB: Due to some duplications of the following modules/functions, we keep
|
||||||
# them as expected failures for the time being instead of return 1
|
# them as expected failures for the time being instead of return 1
|
||||||
ignore_duplicated_modules = {
|
ignore_duplicated_modules = {
|
||||||
@ -3722,11 +3724,11 @@ import sphinx.ext.doctest
|
|||||||
|
|
||||||
# -- A patch that prevents Sphinx from cross-referencing ivar tags -------
|
# -- A patch that prevents Sphinx from cross-referencing ivar tags -------
|
||||||
# See http://stackoverflow.com/a/41184353/3343043
|
# See http://stackoverflow.com/a/41184353/3343043
|
||||||
|
|
||||||
from docutils import nodes
|
from docutils import nodes
|
||||||
from sphinx import addnodes
|
from sphinx import addnodes
|
||||||
from sphinx.util.docfields import TypedField
|
from sphinx.util.docfields import TypedField
|
||||||
|
|
||||||
|
|
||||||
# Without this, doctest adds any example with a `>>>` as a test
|
# Without this, doctest adds any example with a `>>>` as a test
|
||||||
doctest_test_doctest_blocks = ""
|
doctest_test_doctest_blocks = ""
|
||||||
doctest_default_flags = sphinx.ext.doctest.doctest.ELLIPSIS
|
doctest_default_flags = sphinx.ext.doctest.doctest.ELLIPSIS
|
||||||
|
@ -11,6 +11,7 @@ from matplotlib import pyplot as plt
|
|||||||
|
|
||||||
import torch
|
import torch
|
||||||
|
|
||||||
|
|
||||||
matplotlib.use("Agg")
|
matplotlib.use("Agg")
|
||||||
|
|
||||||
|
|
||||||
|
@ -4,9 +4,9 @@ from pathlib import Path
|
|||||||
|
|
||||||
import torch
|
import torch
|
||||||
import torch._prims as prims
|
import torch._prims as prims
|
||||||
|
|
||||||
from torchgen.gen import parse_native_yaml
|
from torchgen.gen import parse_native_yaml
|
||||||
|
|
||||||
|
|
||||||
ROOT = Path(__file__).absolute().parent.parent.parent.parent
|
ROOT = Path(__file__).absolute().parent.parent.parent.parent
|
||||||
NATIVE_FUNCTION_YAML_PATH = ROOT / Path("aten/src/ATen/native/native_functions.yaml")
|
NATIVE_FUNCTION_YAML_PATH = ROOT / Path("aten/src/ATen/native/native_functions.yaml")
|
||||||
TAGS_YAML_PATH = ROOT / Path("aten/src/ATen/native/tags.yaml")
|
TAGS_YAML_PATH = ROOT / Path("aten/src/ATen/native/tags.yaml")
|
||||||
|
@ -5,7 +5,6 @@ from pathlib import Path
|
|||||||
|
|
||||||
import torch
|
import torch
|
||||||
import torch._dynamo as torchdynamo
|
import torch._dynamo as torchdynamo
|
||||||
|
|
||||||
from torch._export.db.case import ExportCase
|
from torch._export.db.case import ExportCase
|
||||||
from torch._export.db.examples import all_examples
|
from torch._export.db.examples import all_examples
|
||||||
from torch.export import export
|
from torch.export import export
|
||||||
|
@ -8,6 +8,7 @@ import os
|
|||||||
|
|
||||||
from torch.onnx import _onnx_supported_ops
|
from torch.onnx import _onnx_supported_ops
|
||||||
|
|
||||||
|
|
||||||
# Constants
|
# Constants
|
||||||
BUILD_DIR = "build/onnx"
|
BUILD_DIR = "build/onnx"
|
||||||
SUPPORTED_OPS_CSV_FILE = "auto_gen_supported_op_list.csv"
|
SUPPORTED_OPS_CSV_FILE = "auto_gen_supported_op_list.csv"
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
from torchvision import models
|
from torchvision import models
|
||||||
|
|
||||||
import torch
|
import torch
|
||||||
|
|
||||||
from torch.backends._coreml.preprocess import CompileSpec, CoreMLComputeUnit, TensorSpec
|
from torch.backends._coreml.preprocess import CompileSpec, CoreMLComputeUnit, TensorSpec
|
||||||
|
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@ from torchvision import models
|
|||||||
import torch
|
import torch
|
||||||
from torch.utils.mobile_optimizer import optimize_for_mobile
|
from torch.utils.mobile_optimizer import optimize_for_mobile
|
||||||
|
|
||||||
|
|
||||||
model = models.mobilenet_v2(weights=models.MobileNet_V2_Weights.IMAGENET1K_V1)
|
model = models.mobilenet_v2(weights=models.MobileNet_V2_Weights.IMAGENET1K_V1)
|
||||||
model.eval()
|
model.eval()
|
||||||
example = torch.rand(1, 3, 224, 224)
|
example = torch.rand(1, 3, 224, 224)
|
||||||
|
@ -3,6 +3,7 @@ from torchvision import models
|
|||||||
|
|
||||||
import torch
|
import torch
|
||||||
|
|
||||||
|
|
||||||
model = models.mobilenet_v2(weights=models.MobileNet_V2_Weights.IMAGENET1K_V1)
|
model = models.mobilenet_v2(weights=models.MobileNet_V2_Weights.IMAGENET1K_V1)
|
||||||
model.eval()
|
model.eval()
|
||||||
example = torch.rand(1, 3, 224, 224)
|
example = torch.rand(1, 3, 224, 224)
|
||||||
|
@ -12,6 +12,7 @@ from typing import Any
|
|||||||
import boto3
|
import boto3
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
|
|
||||||
POLLING_DELAY_IN_SECOND = 5
|
POLLING_DELAY_IN_SECOND = 5
|
||||||
MAX_UPLOAD_WAIT_IN_SECOND = 600
|
MAX_UPLOAD_WAIT_IN_SECOND = 600
|
||||||
|
|
||||||
|
@ -20,6 +20,7 @@ import csv
|
|||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
|
||||||
parser = argparse.ArgumentParser(
|
parser = argparse.ArgumentParser(
|
||||||
description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter
|
description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter
|
||||||
)
|
)
|
||||||
|
@ -2,6 +2,7 @@ import functools
|
|||||||
import os
|
import os
|
||||||
import warnings
|
import warnings
|
||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import lxml.etree
|
import lxml.etree
|
||||||
|
|
||||||
|
@ -2,7 +2,6 @@ import argparse
|
|||||||
import re
|
import re
|
||||||
|
|
||||||
from common import download_reports, get_testcases, key, open_test_results, skipped_test
|
from common import download_reports, get_testcases, key, open_test_results, skipped_test
|
||||||
|
|
||||||
from passrate import compute_pass_rate
|
from passrate import compute_pass_rate
|
||||||
|
|
||||||
|
|
||||||
|
@ -7,9 +7,9 @@ from common import (
|
|||||||
key,
|
key,
|
||||||
open_test_results,
|
open_test_results,
|
||||||
)
|
)
|
||||||
|
|
||||||
from download_reports import download_reports
|
from download_reports import download_reports
|
||||||
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Usage: passrate.py commit_sha
|
Usage: passrate.py commit_sha
|
||||||
|
|
||||||
|
@ -12,9 +12,9 @@ from common import (
|
|||||||
key,
|
key,
|
||||||
open_test_results,
|
open_test_results,
|
||||||
)
|
)
|
||||||
|
|
||||||
from download_reports import download_reports
|
from download_reports import download_reports
|
||||||
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Usage: update_failures.py /path/to/dynamo_test_failures.py /path/to/test commit_sha
|
Usage: update_failures.py /path/to/dynamo_test_failures.py /path/to/test commit_sha
|
||||||
|
|
||||||
|
@ -17,6 +17,7 @@ import os
|
|||||||
import re
|
import re
|
||||||
from subprocess import PIPE, Popen
|
from subprocess import PIPE, Popen
|
||||||
|
|
||||||
|
|
||||||
# Get python protobuf version.
|
# Get python protobuf version.
|
||||||
try:
|
try:
|
||||||
import google.protobuf
|
import google.protobuf
|
||||||
|
@ -5,6 +5,7 @@ from yaml import dump, Dumper
|
|||||||
|
|
||||||
from torch._export.serde import schema_check
|
from torch._export.serde import schema_check
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
parser = argparse.ArgumentParser(prog="update_schema")
|
parser = argparse.ArgumentParser(prog="update_schema")
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
import sys
|
import sys
|
||||||
import sysconfig
|
import sysconfig
|
||||||
|
|
||||||
|
|
||||||
flags = [
|
flags = [
|
||||||
f"-DPython_EXECUTABLE:FILEPATH={sys.executable}",
|
f"-DPython_EXECUTABLE:FILEPATH={sys.executable}",
|
||||||
]
|
]
|
||||||
|
@ -11,6 +11,7 @@ from torch.utils.jit.log_extract import (
|
|||||||
run_nvfuser,
|
run_nvfuser,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Usage:
|
Usage:
|
||||||
1. Run your script and pipe into a log file
|
1. Run your script and pipe into a log file
|
||||||
|
@ -6,6 +6,7 @@ import csv
|
|||||||
|
|
||||||
import commitlist
|
import commitlist
|
||||||
|
|
||||||
|
|
||||||
category_csv = "results/category_data.csv"
|
category_csv = "results/category_data.csv"
|
||||||
commitlist_csv = "results/commitlist.csv"
|
commitlist_csv = "results/commitlist.csv"
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@ from os import path
|
|||||||
|
|
||||||
import torch
|
import torch
|
||||||
|
|
||||||
|
|
||||||
# Import all utils so that getattr below can find them
|
# Import all utils so that getattr below can find them
|
||||||
|
|
||||||
all_submod_list = [
|
all_submod_list = [
|
||||||
|
3
setup.py
3
setup.py
@ -201,6 +201,7 @@
|
|||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
|
||||||
if sys.platform == "win32" and sys.maxsize.bit_length() == 31:
|
if sys.platform == "win32" and sys.maxsize.bit_length() == 31:
|
||||||
print(
|
print(
|
||||||
"32-bit Windows Python runtime is not supported. Please switch to 64-bit Python."
|
"32-bit Windows Python runtime is not supported. Please switch to 64-bit Python."
|
||||||
@ -209,6 +210,7 @@ if sys.platform == "win32" and sys.maxsize.bit_length() == 31:
|
|||||||
|
|
||||||
import platform
|
import platform
|
||||||
|
|
||||||
|
|
||||||
BUILD_LIBTORCH_WHL = os.getenv("BUILD_LIBTORCH_WHL", "0") == "1"
|
BUILD_LIBTORCH_WHL = os.getenv("BUILD_LIBTORCH_WHL", "0") == "1"
|
||||||
BUILD_PYTHON_ONLY = os.getenv("BUILD_PYTHON_ONLY", "0") == "1"
|
BUILD_PYTHON_ONLY = os.getenv("BUILD_PYTHON_ONLY", "0") == "1"
|
||||||
|
|
||||||
@ -236,7 +238,6 @@ import setuptools.command.install
|
|||||||
import setuptools.command.sdist
|
import setuptools.command.sdist
|
||||||
from setuptools import Extension, find_packages, setup
|
from setuptools import Extension, find_packages, setup
|
||||||
from setuptools.dist import Distribution
|
from setuptools.dist import Distribution
|
||||||
|
|
||||||
from tools.build_pytorch_libs import build_caffe2
|
from tools.build_pytorch_libs import build_caffe2
|
||||||
from tools.generate_torch_version import get_torch_version
|
from tools.generate_torch_version import get_torch_version
|
||||||
from tools.setup_helpers.cmake import CMake
|
from tools.setup_helpers.cmake import CMake
|
||||||
|
@ -29,7 +29,6 @@ ISORT_WHITELIST = re.compile(
|
|||||||
fnmatch.translate,
|
fnmatch.translate,
|
||||||
[
|
[
|
||||||
# **
|
# **
|
||||||
"**",
|
|
||||||
# .ci/**
|
# .ci/**
|
||||||
".ci/**",
|
".ci/**",
|
||||||
# .github/**
|
# .github/**
|
||||||
|
Reference in New Issue
Block a user