Flip default value for mypy disallow_untyped_defs [4/11] (#127841)

See #127836 for details.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/127841
Approved by: https://github.com/oulgen
This commit is contained in:
Aaron Orenstein
2024-06-08 11:33:07 -07:00
committed by PyTorch MergeBot
parent afe15d2d2f
commit 62bcdc0ac9
128 changed files with 142 additions and 15 deletions

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from collections import defaultdict
from copy import deepcopy
from typing import Any, Optional, Dict, TYPE_CHECKING

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from torch.ao.pruning._experimental.data_sparsifier.data_norm_sparsifier import DataNormSparsifier
from torch.ao.pruning._experimental.data_scheduler.base_data_scheduler import BaseDataScheduler
import torch

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import torch
import torch.nn as nn
from torch.ao.pruning.sparsifier.utils import module_to_fqn, fqn_to_module

View File

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

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from itertools import chain
from operator import getitem
import torch

View File

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

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import torch
from torch import nn
from torch.nn.utils.parametrize import is_parametrized

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
"""
Collection of conversion functions for linear / conv2d structured pruning
Also contains utilities for bias propagation

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from .base_structured_sparsifier import BaseStructuredSparsifier

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
__all__ = [
"get_static_sparse_quantized_mapping",
"get_dynamic_sparse_quantized_mapping",

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from torch.ao.pruning import BaseSparsifier

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import warnings
from .base_scheduler import BaseScheduler

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import warnings
from .base_scheduler import BaseScheduler

View File

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

View File

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

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from typing import Any, Dict, Optional, Type
from torch.nn.utils.parametrize import type_before_parametrizations, is_parametrized
from itertools import chain

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from functools import reduce
from typing import Callable, Optional, Tuple, Union

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
# flake8: noqa: F403
from .fake_quantize import * # noqa: F403

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import torch
import torch.nn as nn
import torch.ao.nn.quantized as nnq

View File

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

View File

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

View File

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

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import operator
import torch
from torch.ao.quantization.backend_config import (

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from __future__ import annotations
from dataclasses import dataclass
from typing import Any, Callable, Dict, List, Optional, Type, Union, TYPE_CHECKING

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import torch
from ._common_operator_config_utils import (
_get_binary_op_configs,

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import torch
import torch.nn as nn
import torch.ao.nn.intrinsic as nni

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import torch
from .backend_config import (
BackendConfig,

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from typing import Dict, Any, List, Callable, Union, Tuple, Type
import torch

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import torch
from torch.ao.quantization.experimental.quantizer import APoTQuantizer

View File

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

View File

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

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
r"""
This file contains utility functions to convert values
using APoT nonuniform quantization methods.

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import torch
from torch import Tensor
from torch.ao.quantization.experimental.observer import APoTObserver

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import torch
from torch import Tensor
from torch.ao.quantization.experimental.quantizer import quantize_APoT, dequantize_APoT

View File

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

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
"""
This module implements nonuniform observers used to collect statistics about
the values observed during calibration (PTQ) or training (QAT).

View File

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

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
"""Implements modules used to perform fake quantization."""
import torch

View File

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

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import torch.nn as nn
import torch.ao.nn.intrinsic as nni

View File

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

View File

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

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import torch
from torch.fx import map_arg, Node
from torch.fx.graph import Graph

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from typing import Any, Dict, Set, Tuple, Callable, List
import torch

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from typing import Any, Dict, Set, Tuple, Callable
from collections import OrderedDict
import torch

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import torch
from torch.ao.quantization.observer import ObserverBase

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import torch
from typing import Any, Set, Dict, List, Tuple, OrderedDict
from collections import OrderedDict as OrdDict

View File

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

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from torch.fx import (
GraphModule,
Node,

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import torch
from torch.ao.quantization.backend_config import BackendConfig
from torch.fx.graph import Node, Graph

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import torch
import copy
from torch.fx import GraphModule

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import sys
import torch
from torch.fx.graph import (

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from collections import OrderedDict
from typing import Dict, Any
from torch.ao.quantization.utils import Pattern

View File

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

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import torch
import re
from collections import defaultdict, OrderedDict

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from abc import ABC
from typing import Callable, Dict, List, Optional, Type

View File

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

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
"""
This module implements observers which are used to collect statistics about
the values observed during calibration (PTQ) or training (QAT).

View File

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

View File

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

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import itertools
from typing import Any, List, OrderedDict, Set, Optional, Callable
import operator

View File

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

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import torch
from torch._subclasses import FakeTensor
from torch.ao.quantization.fx.prepare import (

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import dataclasses
import itertools
import operator

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import torch
from torch.fx import GraphModule
from ..export_utils import _WrapperModule

View File

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

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from collections import namedtuple
from typing import Optional, Any, Union, Type
from typing_extensions import deprecated

View File

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

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import copy
import itertools
import warnings

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import torch
from torch.ao.quantization.qconfig import QConfig

View File

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

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from abc import ABC, abstractmethod
from dataclasses import dataclass, field
from typing import Callable, Dict, List, Optional, Tuple, Union

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from typing import List
from torch.ao.quantization.pt2e.utils import _is_sym_size_node

View File

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

View File

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

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import itertools
import operator
from dataclasses import dataclass

View File

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

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
"""
Utils shared by different modes of quantization (eager/graph)
"""

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
"""
``torch.autograd`` provides classes and functions implementing automatic
differentiation of arbitrary scalar valued functions. It requires minimal

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import abc
import collections
import contextlib

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from collections import defaultdict
from dataclasses import dataclass
from time import perf_counter_ns

View File

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

View File

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

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import torch
from torch._C import _ImperativeEngine as ImperativeEngine

View File

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

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import hashlib
import json
from typing import Dict, Tuple

View File

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

View File

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

View File

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

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import os
import sys
import warnings

View File

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

View File

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

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