Flip default value for mypy disallow_untyped_defs [8/11] (#127845)

See #127836 for details.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/127845
Approved by: https://github.com/oulgen
ghstack dependencies: #127842, #127843, #127844
This commit is contained in:
Aaron Orenstein
2024-06-08 11:41:15 -07:00
committed by PyTorch MergeBot
parent 038b927590
commit 27f9d3b0a1
128 changed files with 128 additions and 0 deletions

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
# this is for historical pickle deserialization, it is not used otherwise
def _get_thnn_function_backend():

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
"""Functionality for Python <-> C++ frontend inter-op."""
from torch import nn

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
"""Gradient interface."""
import torch

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
"""This file contains utilities for initializing neural network parameters."""
import math
import warnings

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import torch
import torch.distributed as dist

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import warnings
from typing import Optional, Tuple

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from collections import namedtuple

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from typing import Optional, Any
import torch

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from collections import OrderedDict, abc as container_abcs
from itertools import chain, islice
import operator

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import math
import torch

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from .module import Module
from typing import Tuple, Union

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import warnings
from torch import Tensor

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import itertools
from typing import Protocol, Optional, Type, Any

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import math
from typing import Any

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from .distance import PairwiseDistance
from .module import Module
from .. import functional as F

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from collections import OrderedDict, namedtuple
import itertools
import warnings

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import torch
import numbers
from torch.nn.parameter import Parameter

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from .module import Module
from .utils import _pair, _quadruple, _ntuple
from .. import functional as F

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import math
import warnings
import numbers

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from typing import Optional
import torch

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import copy
from typing import Optional, Any, Union, Callable

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from .module import Module
from .. import functional as F

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import collections
from itertools import repeat
from typing import List, Dict, Any

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from typing_extensions import deprecated
from .parallel_apply import parallel_apply

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import warnings
import torch
from torch.cuda import nccl

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import operator
import torch
import warnings

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import copy
import functools
import inspect

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import torch
from typing import Any, Dict, List, Optional, Sequence, Tuple, TypeVar, Union, overload
from typing_extensions import deprecated

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import builtins
from typing import Optional, Tuple

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from typing import List, Callable
import importlib
import warnings

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import torch
import torch.nn.functional as F

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import torch
import torch.nn.functional as F

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import torch
import torch.nn.functional as F
from .expanded_weights_impl import implements_per_sample_grads

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from contextlib import contextmanager
import torch

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from typing import Optional
import torch

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from functools import reduce
import operator
import torch

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from functools import partial
import torch
import torch.nn.functional as F

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import torch
import torch.nn.functional as F

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import torch
import torch.nn.functional as F
from .expanded_weights_impl import implements_per_sample_grads

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import functools
import torch

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import functools
from typing import Union, Iterable, List, Dict, Tuple, Optional, cast
from typing_extensions import deprecated

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import inspect
import torch

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import torch

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from enum import Enum, auto
import torch

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import torch
from torch.__future__ import get_swap_module_params_on_conversion
from torch.nn.modules.container import ModuleList, ModuleDict, Module

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
r"""Pruning methods."""
import numbers
from abc import ABC, abstractmethod

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from typing import Any, Iterable, NamedTuple, Optional, overload, Sequence, Tuple, Union
from typing_extensions import Self

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
"""Spectral Normalization from https://arxiv.org/abs/1802.05957."""
import torch
from torch.nn.functional import normalize

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import contextlib
from collections import defaultdict
from typing import Any, Dict, Iterator, Optional, Set, Tuple, Union

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
r"""Weight Normalization from https://arxiv.org/abs/1602.07868."""
from torch.nn.parameter import Parameter, UninitializedParameter
from torch import _weight_norm, norm_except_dim

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from torch import _C
from torch._C import _onnx as _C_onnx
from torch._C._onnx import (

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
"""Utility for deprecating functions."""
import functools

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
"""Globals used internally by the ONNX exporter.
Do not use this module outside of `torch.onnx` and its tests.

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
"""An internal wrapper for the beartype library.
The module returns a no-op decorator when the beartype library is not installed.

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
"""Diagnostic components for TorchScript based ONNX export, i.e. `torch.onnx.export`."""
from __future__ import annotations

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
"""
GENERATED CODE - DO NOT EDIT DIRECTLY
This file is generated by gen_diagnostics.py.

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
"""This file defines an additional layer of abstraction on top of the SARIF OM."""
from __future__ import annotations

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
"""A diagnostic context based on SARIF."""
from __future__ import annotations

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from __future__ import annotations
import functools

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from __future__ import ( # for onnx.ModelProto (ONNXProgram) and onnxruntime (ONNXRuntimeOptions)
annotations,
)

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from __future__ import annotations
import abc

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from __future__ import annotations
import dataclasses

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
"""A context manager that disables the decomposition of certain ops during dynamo tracing.
The approach is to temporarily hijack the operator callable with PT2 custom operator.

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
"""Dispatcher for AtenLib functions from onnx-script."""
from __future__ import annotations

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from __future__ import annotations
import dataclasses

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
# NOTE: This file is referenced by name at
# /opt/pytorch/torch/_dynamo/eval_frame.py::DONT_WRAP_FILES.
# introduced by https://github.com/pytorch/pytorch/pull/98894.

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from __future__ import annotations
import inspect

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from __future__ import annotations
import functools

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
"""Dispatcher for AtenLib functions from onnx-script."""
from __future__ import annotations

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
"""Module for handling op-level validation during exporting."""
from __future__ import annotations

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
"""Common utility functions for FX passes.
These functions should NOT be directly invoked outside of `passes` package.

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from __future__ import annotations
import contextlib

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from __future__ import annotations
import contextlib

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from __future__ import annotations
import abc

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from __future__ import annotations
from typing import Dict, List, Sequence, Tuple, Union

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
# Owner(s): ["module: onnx"]
from __future__ import annotations

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from __future__ import annotations
from typing import List, Optional, Tuple

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import copy
import functools
import io

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from __future__ import annotations
import io

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
# NOTE: This file is referenced by name at
# /opt/pytorch/torch/_dynamo/eval_frame.py::DONT_WRAP_FILES.
# introduced by https://github.com/pytorch/pytorch/pull/98894.

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
"""Utilities for converting and operating on ONNX, JIT and torch types."""
from __future__ import annotations

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from __future__ import annotations
import inspect

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
"""Utilities for manipulating the torch.Graph object and the torchscript."""
from __future__ import annotations

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
"""Utilities for manipulating the onnx and onnx-script dependencies and ONNX proto."""
from __future__ import annotations

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import dataclasses
import importlib
import logging

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
"""Module for handling symbolic function registration."""
import warnings

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import inspect
from typing import Dict, List, Union

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
"""Utilities for converting and operating on ONNX, JIT and torch types."""
from __future__ import annotations

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
r"""This file provides a location for operators that help exporting models via onnx.
E.g. `shape_as_tensor` and `reshape_from_tensor_shape`

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import importlib
import inspect

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from __future__ import annotations
import functools

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from __future__ import annotations
import functools

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
"""This file exports ONNX ops for opset 11."""
from __future__ import annotations

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from __future__ import annotations
import functools

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
# EDITING THIS FILE? READ THIS FIRST!
# see Note [Edit Symbolic Files] in README.md

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
"""This file exports ONNX ops for opset 14.
Note [ONNX operators that are added/updated in opset 14]

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
"""This file exports ONNX ops for opset 15.
Note [ONNX operators that are added/updated in opset 15]

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
"""This file exports ONNX ops for opset 16.
Note [ONNX Operators that are added/updated in opset 16]

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
"""This file exports ONNX ops for opset 17.
Note [ONNX Operators that are added/updated in opset 17]

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
"""This file exports ONNX ops for opset 18.
Note [ONNX Operators that are added/updated in opset 18]

Some files were not shown because too many files have changed in this diff Show More