mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
Flip default value for mypy disallow_untyped_defs [9/11] (#127846)
See #127836 for details. Pull Request resolved: https://github.com/pytorch/pytorch/pull/127846 Approved by: https://github.com/ezyang ghstack dependencies: #127842, #127843, #127844, #127845
This commit is contained in:
committed by
PyTorch MergeBot
parent
27f9d3b0a1
commit
8db9dfa2d7
@ -1,3 +1,4 @@
|
||||
# mypy: allow-untyped-defs
|
||||
"""isort:skip_file"""
|
||||
from pickle import ( # type: ignore[attr-defined]
|
||||
_compat_pickle,
|
||||
|
@ -1,3 +1,4 @@
|
||||
# mypy: allow-untyped-defs
|
||||
import _compat_pickle
|
||||
import pickle
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
# mypy: allow-untyped-defs
|
||||
"""List of Python standard library modules.
|
||||
|
||||
Sadly, there is no reliable way to tell whether a module is part of the
|
||||
|
@ -1,3 +1,4 @@
|
||||
# mypy: allow-untyped-defs
|
||||
import sys
|
||||
from typing import Any, Callable, Iterable, List, Tuple
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
# mypy: allow-untyped-defs
|
||||
from typing import Dict, List
|
||||
|
||||
from .glob_group import GlobGroup, GlobPattern
|
||||
|
@ -1,3 +1,4 @@
|
||||
# mypy: allow-untyped-defs
|
||||
import ast
|
||||
from typing import List, Optional, Tuple
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
# mypy: allow-untyped-defs
|
||||
import re
|
||||
from typing import Iterable, Union
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
# mypy: allow-untyped-defs
|
||||
import importlib
|
||||
from abc import ABC, abstractmethod
|
||||
from pickle import ( # type: ignore[attr-defined] # type: ignore[attr-defined]
|
||||
|
@ -1,3 +1,4 @@
|
||||
# mypy: allow-untyped-defs
|
||||
import collections
|
||||
import importlib.machinery
|
||||
import io
|
||||
|
@ -1,3 +1,4 @@
|
||||
# mypy: allow-untyped-defs
|
||||
import builtins
|
||||
import importlib
|
||||
import importlib.machinery
|
||||
|
@ -1,3 +1,4 @@
|
||||
# mypy: allow-untyped-defs
|
||||
r"""
|
||||
PyTorch Profiler is a tool that allows the collection of performance metrics during training and inference.
|
||||
Profiler's context manager API can be used to better understand what model operators are the most expensive,
|
||||
|
@ -1,3 +1,4 @@
|
||||
# mypy: allow-untyped-defs
|
||||
import collections
|
||||
import dataclasses
|
||||
import enum
|
||||
|
@ -1,3 +1,4 @@
|
||||
# mypy: allow-untyped-defs
|
||||
import json
|
||||
import math
|
||||
import os
|
||||
|
@ -1,3 +1,4 @@
|
||||
# mypy: allow-untyped-defs
|
||||
import functools
|
||||
import operator
|
||||
import re
|
||||
|
@ -1,3 +1,4 @@
|
||||
# mypy: allow-untyped-defs
|
||||
from contextlib import contextmanager
|
||||
|
||||
try:
|
||||
|
@ -1,3 +1,4 @@
|
||||
# mypy: allow-untyped-defs
|
||||
import gzip
|
||||
import json
|
||||
import os
|
||||
|
@ -1,3 +1,4 @@
|
||||
# mypy: allow-untyped-defs
|
||||
from .quantize import * # noqa: F403
|
||||
from .observer import * # noqa: F403
|
||||
from .qconfig import * # noqa: F403
|
||||
|
@ -1,3 +1,4 @@
|
||||
# mypy: allow-untyped-defs
|
||||
import torch
|
||||
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
# mypy: allow-untyped-defs
|
||||
import torch
|
||||
from typing import Optional
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
# mypy: allow-untyped-defs
|
||||
import contextlib
|
||||
from typing import Generator
|
||||
import warnings
|
||||
|
@ -1,3 +1,4 @@
|
||||
# mypy: allow-untyped-defs
|
||||
import difflib
|
||||
import functools
|
||||
import os
|
||||
|
@ -1,3 +1,4 @@
|
||||
# mypy: allow-untyped-defs
|
||||
from typing import Optional, Iterable
|
||||
|
||||
import torch
|
||||
|
@ -1,3 +1,4 @@
|
||||
# mypy: allow-untyped-defs
|
||||
# The Tensor classes are added to this module by python_tensor.cpp
|
||||
from typing import Optional, Tuple, List, Union, Any
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
# mypy: allow-untyped-defs
|
||||
import torch
|
||||
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
# mypy: allow-untyped-defs
|
||||
import contextlib
|
||||
|
||||
import torch
|
||||
|
@ -1,3 +1,4 @@
|
||||
# mypy: allow-untyped-defs
|
||||
import math
|
||||
import os
|
||||
import torch
|
||||
|
@ -1,3 +1,4 @@
|
||||
# mypy: allow-untyped-defs
|
||||
"""Provides optimal triton kernel parameters.
|
||||
|
||||
Aim
|
||||
|
@ -1,3 +1,4 @@
|
||||
# mypy: allow-untyped-defs
|
||||
import warnings
|
||||
from collections import namedtuple
|
||||
from typing import Any, Optional, Tuple, List, Callable, Dict
|
||||
|
@ -1,3 +1,4 @@
|
||||
# mypy: allow-untyped-defs
|
||||
import io
|
||||
|
||||
import torch
|
||||
|
@ -1,3 +1,4 @@
|
||||
# mypy: allow-untyped-defs
|
||||
import abc
|
||||
import cmath
|
||||
import collections.abc
|
||||
|
@ -1,3 +1,4 @@
|
||||
# mypy: allow-untyped-defs
|
||||
# Owner(s): ["oncall: distributed"]
|
||||
|
||||
import contextlib
|
||||
|
@ -1,3 +1,4 @@
|
||||
# mypy: allow-untyped-defs
|
||||
import torch
|
||||
import functools
|
||||
from torch.testing import make_tensor
|
||||
|
@ -1,3 +1,4 @@
|
||||
# mypy: allow-untyped-defs
|
||||
import logging
|
||||
import os
|
||||
import sys
|
||||
|
@ -1,3 +1,4 @@
|
||||
# mypy: allow-untyped-defs
|
||||
# Owner(s): ["module: unknown"]
|
||||
|
||||
import torch
|
||||
|
@ -1,3 +1,4 @@
|
||||
# mypy: allow-untyped-defs
|
||||
import contextlib
|
||||
from typing import Optional
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
# mypy: allow-untyped-defs
|
||||
import contextlib
|
||||
|
||||
import torch
|
||||
|
@ -1,3 +1,4 @@
|
||||
# mypy: allow-untyped-defs
|
||||
import builtins
|
||||
from typing import Any, List, Optional, Sequence, Tuple, Union
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
# mypy: allow-untyped-defs
|
||||
import os.path as _osp
|
||||
import torch
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
# mypy: allow-untyped-defs
|
||||
import contextlib
|
||||
|
||||
import copy
|
||||
|
@ -1,3 +1,4 @@
|
||||
# mypy: allow-untyped-defs
|
||||
from typing import Any, Dict, Optional, TYPE_CHECKING, Union
|
||||
|
||||
"""
|
||||
|
@ -1,3 +1,4 @@
|
||||
# mypy: allow-untyped-defs
|
||||
# This module provides a FAST (on GPU) content addressable store for storages
|
||||
# (and tensors on top of them) with VERY WEAK portability guarantees (e.g.,
|
||||
# don't expect CPU/CUDA to address to the same hash, don't expect it to be
|
||||
|
@ -1,3 +1,4 @@
|
||||
# mypy: allow-untyped-defs
|
||||
# Extra utilities for working with context managers that should have been
|
||||
# in the standard library but are not
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
# mypy: allow-untyped-defs
|
||||
import collections
|
||||
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
# mypy: allow-untyped-defs
|
||||
from typing import Optional
|
||||
import torch
|
||||
from torch.overrides import TorchFunctionMode
|
||||
|
@ -1,3 +1,4 @@
|
||||
# mypy: allow-untyped-defs
|
||||
# Allows one to expose an API in a private submodule publicly as per the definition
|
||||
# in PyTorch's public api policy.
|
||||
#
|
||||
|
@ -1,3 +1,4 @@
|
||||
# mypy: allow-untyped-defs
|
||||
"""
|
||||
Freeze Python packages.
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
# mypy: allow-untyped-defs
|
||||
import argparse
|
||||
import os
|
||||
import re
|
||||
|
@ -1,3 +1,4 @@
|
||||
# mypy: allow-untyped-defs
|
||||
import functools
|
||||
import importlib.util
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
# mypy: allow-untyped-defs
|
||||
import torch
|
||||
from typing import TypeVar
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
# mypy: allow-untyped-defs
|
||||
import contextlib
|
||||
|
||||
import warnings
|
||||
|
@ -1,3 +1,4 @@
|
||||
# mypy: allow-untyped-defs
|
||||
# NOTE! PLEASE KEEP THIS FILE *FREE* OF TORCH DEPS! IT SHOULD BE IMPORTABLE ANYWHERE.
|
||||
# IF YOU FEEL AN OVERWHELMING URGE TO ADD A TORCH DEP, MAKE A TRAMPOLINE FILE A LA torch._dynamo.utils
|
||||
# AND SCRUB AWAY TORCH NOTIONS THERE.
|
||||
|
@ -1,3 +1,4 @@
|
||||
# mypy: allow-untyped-defs
|
||||
import torch
|
||||
|
||||
from torch.utils._strobelight.cli_function_profiler import (
|
||||
|
@ -1,3 +1,4 @@
|
||||
# mypy: allow-untyped-defs
|
||||
import math
|
||||
|
||||
import sympy
|
||||
|
@ -1,3 +1,4 @@
|
||||
# mypy: allow-untyped-defs
|
||||
"""
|
||||
This is a simple interpreter for Sympy expressions that dispatches to
|
||||
classes following the torch._inductor.virtualized calling convention.
|
||||
|
@ -1,3 +1,4 @@
|
||||
# mypy: allow-untyped-defs
|
||||
import math
|
||||
|
||||
import sympy
|
||||
|
@ -1,3 +1,4 @@
|
||||
# mypy: allow-untyped-defs
|
||||
import sympy
|
||||
from sympy.multipledispatch import dispatch
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
# mypy: allow-untyped-defs
|
||||
"""
|
||||
This file contains canonical definitions for our symbol naming conventions,
|
||||
across torch.fx.experimental.symbolic_shapes and torch._inductor. The
|
||||
|
@ -1,3 +1,4 @@
|
||||
# mypy: allow-untyped-defs
|
||||
from __future__ import annotations
|
||||
|
||||
import dataclasses
|
||||
@ -586,7 +587,7 @@ class SymPyValueRangeAnalysis:
|
||||
if 0 in x:
|
||||
return ValueRanges.unknown()
|
||||
else:
|
||||
return ValueRanges.decreasing_map(x, lambda y: 1 / y)
|
||||
return ValueRanges.decreasing_map(x, lambda y: 1 / y) # type: ignore[operator]
|
||||
|
||||
@staticmethod
|
||||
def abs(x):
|
||||
|
@ -1,3 +1,4 @@
|
||||
# mypy: allow-untyped-defs
|
||||
from types import TracebackType
|
||||
from typing import List, Optional
|
||||
import tempfile
|
||||
|
@ -1,3 +1,4 @@
|
||||
# mypy: allow-untyped-defs
|
||||
import functools
|
||||
import hashlib
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
# mypy: allow-untyped-defs
|
||||
import argparse
|
||||
import glob
|
||||
import os
|
||||
|
@ -1,3 +1,4 @@
|
||||
# mypy: allow-untyped-defs
|
||||
from torch._C import _set_backcompat_broadcast_warn
|
||||
from torch._C import _get_backcompat_broadcast_warn
|
||||
from torch._C import _set_backcompat_keepdim_warn
|
||||
|
@ -1,3 +1,4 @@
|
||||
# mypy: allow-untyped-defs
|
||||
import torch
|
||||
from torch.overrides import (
|
||||
handle_torch_function,
|
||||
|
@ -1,3 +1,4 @@
|
||||
# mypy: allow-untyped-defs
|
||||
import collections
|
||||
import os
|
||||
import shutil
|
||||
|
@ -1,3 +1,4 @@
|
||||
# mypy: allow-untyped-defs
|
||||
"""Example of Timer and Compare APIs:
|
||||
|
||||
$ python -m examples.compare
|
||||
|
@ -1,3 +1,4 @@
|
||||
# mypy: allow-untyped-defs
|
||||
"""Example of the Timer and Fuzzer APIs:
|
||||
|
||||
$ python -m examples.fuzzer
|
||||
|
@ -1,3 +1,4 @@
|
||||
# mypy: allow-untyped-defs
|
||||
"""Example use of Timer and op fuzzers to measure kernel performance.
|
||||
|
||||
$ python -m examples.op_benchmark
|
||||
|
@ -1,3 +1,4 @@
|
||||
# mypy: allow-untyped-defs
|
||||
"""Trivial use of Timer API:
|
||||
|
||||
$ python -m examples.simple_timeit
|
||||
|
@ -1,3 +1,4 @@
|
||||
# mypy: allow-untyped-defs
|
||||
"""Example of Timer and Compare APIs:
|
||||
|
||||
$ python -m examples.sparse.compare
|
||||
|
@ -1,3 +1,4 @@
|
||||
# mypy: allow-untyped-defs
|
||||
"""Example of the Timer and Sparse Fuzzer APIs:
|
||||
|
||||
$ python -m examples.sparse.fuzzer
|
||||
|
@ -1,3 +1,4 @@
|
||||
# mypy: allow-untyped-defs
|
||||
"""Example use of Timer and sparse op fuzzers to measure kernel performance.
|
||||
|
||||
$ python -m examples.sparse.op_benchmark
|
||||
|
@ -1,3 +1,4 @@
|
||||
# mypy: allow-untyped-defs
|
||||
"""Microbenchmarks for the torch.fft module"""
|
||||
from argparse import ArgumentParser
|
||||
from collections import namedtuple
|
||||
|
@ -1,3 +1,4 @@
|
||||
# mypy: allow-untyped-defs
|
||||
import numpy as np
|
||||
import torch
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
# mypy: allow-untyped-defs
|
||||
import numpy as np
|
||||
import torch
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
# mypy: allow-untyped-defs
|
||||
|
||||
import numpy as np
|
||||
import torch
|
||||
|
@ -1,3 +1,4 @@
|
||||
# mypy: allow-untyped-defs
|
||||
import math
|
||||
|
||||
import torch
|
||||
|
@ -1,3 +1,4 @@
|
||||
# mypy: allow-untyped-defs
|
||||
import numpy as np
|
||||
import torch
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
# mypy: allow-untyped-defs
|
||||
"""Display class to aggregate and print the results of many measurements."""
|
||||
import collections
|
||||
import enum
|
||||
|
@ -1,3 +1,4 @@
|
||||
# mypy: allow-untyped-defs
|
||||
import torch
|
||||
|
||||
__all__ = ["bench_all", "benchmark_compile"]
|
||||
|
@ -1,3 +1,4 @@
|
||||
# mypy: allow-untyped-defs
|
||||
import functools
|
||||
import itertools as it
|
||||
from typing import Any, Callable, Dict, List, Optional, Tuple, Union
|
||||
|
@ -1,3 +1,4 @@
|
||||
# mypy: allow-untyped-defs
|
||||
from typing import Optional, Tuple, Union
|
||||
from numbers import Number
|
||||
import torch
|
||||
|
@ -1,3 +1,4 @@
|
||||
# mypy: allow-untyped-defs
|
||||
import argparse
|
||||
import cProfile
|
||||
import pstats
|
||||
|
@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env python3
|
||||
# mypy: allow-untyped-defs
|
||||
from typing import Any, TypeVar, Optional, Tuple, List, NamedTuple, Union, Sequence, Dict, Callable
|
||||
import textwrap
|
||||
import torch
|
||||
|
@ -1,3 +1,4 @@
|
||||
# mypy: allow-untyped-defs
|
||||
import contextlib
|
||||
import platform
|
||||
import uuid
|
||||
|
@ -1,3 +1,4 @@
|
||||
# mypy: allow-untyped-defs
|
||||
|
||||
# Unlike the rest of the PyTorch this file must be python2 compliant.
|
||||
# This script outputs relevant system environment info
|
||||
|
@ -1,3 +1,4 @@
|
||||
# mypy: allow-untyped-defs
|
||||
from torch._C import _get_cpp_backtrace
|
||||
|
||||
def get_cpp_backtrace(frames_to_skip=0, maximum_number_of_frames=64) -> str:
|
||||
|
@ -1,3 +1,4 @@
|
||||
# mypy: allow-untyped-defs
|
||||
import copy
|
||||
import glob
|
||||
import importlib
|
||||
|
@ -1,3 +1,4 @@
|
||||
# mypy: allow-untyped-defs
|
||||
r"""Utility classes & functions for data loading. Code in this folder is mostly used by ../dataloder.py.
|
||||
|
||||
A lot of multiprocessing is used in data loading, which only supports running
|
||||
|
@ -1,3 +1,4 @@
|
||||
# mypy: allow-untyped-defs
|
||||
r"""Contains definitions of the methods used by the _BaseDataLoaderIter workers.
|
||||
|
||||
These methods are used to collate samples fetched from dataset into Tensor(s).
|
||||
|
@ -1,3 +1,4 @@
|
||||
# mypy: allow-untyped-defs
|
||||
r"""Contains definitions of the methods used by the _BaseDataLoaderIter to fetch data from an iterable-style or map-style dataset.
|
||||
|
||||
This logic is shared in both single- and multi-processing data loading.
|
||||
|
@ -1,3 +1,4 @@
|
||||
# mypy: allow-untyped-defs
|
||||
r"""Contains definitions of the methods used by the _BaseDataLoaderIter to put fetched tensors into pinned memory.
|
||||
|
||||
These **needs** to be in global scope since Py2 doesn't support serializing
|
||||
|
@ -1,3 +1,4 @@
|
||||
# mypy: allow-untyped-defs
|
||||
r"""Signal handling for multiprocessing data loading.
|
||||
|
||||
NOTE [ Signal handling in multiprocessing data loading ]
|
||||
|
@ -1,3 +1,4 @@
|
||||
# mypy: allow-untyped-defs
|
||||
r""""Contains definitions of the methods used by the _BaseDataLoaderIter workers.
|
||||
|
||||
These **needs** to be in global scope since Py2 doesn't support serializing
|
||||
|
@ -1,3 +1,4 @@
|
||||
# mypy: allow-untyped-defs
|
||||
from typing_extensions import deprecated as _deprecated
|
||||
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
# mypy: allow-untyped-defs
|
||||
r"""Definition of the DataLoader and associated iterators that subclass _BaseDataLoaderIter.
|
||||
|
||||
To support these two classes, in `./_utils` we define many utility methods and
|
||||
|
@ -1,3 +1,4 @@
|
||||
# mypy: allow-untyped-defs
|
||||
import inspect
|
||||
from functools import wraps
|
||||
from typing import Any, Callable, Optional, Type, Union, get_type_hints
|
||||
|
@ -1,3 +1,4 @@
|
||||
# mypy: allow-untyped-defs
|
||||
import inspect
|
||||
import functools
|
||||
from enum import Enum
|
||||
|
@ -1,3 +1,4 @@
|
||||
# mypy: allow-untyped-defs
|
||||
# Taking reference from official Python typing
|
||||
# https://github.com/python/cpython/blob/master/Lib/typing.py
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
# mypy: allow-untyped-defs
|
||||
from typing import Any, Optional
|
||||
|
||||
_pandas: Any = None
|
||||
|
@ -1,3 +1,4 @@
|
||||
# mypy: allow-untyped-defs
|
||||
from typing import Any, Dict, List, Optional
|
||||
|
||||
from torch.utils.data.datapipes._decorator import functional_datapipe
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user