mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
[2/N] Apply ruff UP035 check in torch files (#164054)
This is the result of applying the ruff `UP035` check. `Callable` is imported from `collections.abc` instead of `typing`. `TypeAlias` is also imported from `typing`. This PR is the follow-up of #163947. Pull Request resolved: https://github.com/pytorch/pytorch/pull/164054 Approved by: https://github.com/ezyang, https://github.com/Skylion007
This commit is contained in:
committed by
PyTorch MergeBot
parent
352197c508
commit
3cda34ebde
@ -8,8 +8,9 @@ import itertools
|
|||||||
import math
|
import math
|
||||||
import operator
|
import operator
|
||||||
import warnings
|
import warnings
|
||||||
|
from collections.abc import Callable
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
from typing import Any, Callable, NamedTuple, Optional, Union
|
from typing import Any, NamedTuple, Optional, Union
|
||||||
|
|
||||||
import torch
|
import torch
|
||||||
from torch import Tensor
|
from torch import Tensor
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
from typing import Optional, TypeVar, Union
|
from typing import Optional, TypeAlias as _TypeAlias, TypeVar, Union
|
||||||
from typing_extensions import TypeAlias as _TypeAlias
|
|
||||||
|
|
||||||
from torch import Tensor
|
from torch import Tensor
|
||||||
|
|
||||||
|
@ -3,7 +3,8 @@
|
|||||||
import importlib
|
import importlib
|
||||||
import math
|
import math
|
||||||
import warnings
|
import warnings
|
||||||
from typing import Callable, Optional, TYPE_CHECKING, Union
|
from collections.abc import Callable
|
||||||
|
from typing import Optional, TYPE_CHECKING, Union
|
||||||
|
|
||||||
import torch
|
import torch
|
||||||
from torch import _VF, sym_int as _sym_int, Tensor
|
from torch import _VF, sym_int as _sym_int, Tensor
|
||||||
|
@ -2,7 +2,8 @@
|
|||||||
|
|
||||||
import math
|
import math
|
||||||
import warnings
|
import warnings
|
||||||
from typing import Callable, Literal, Optional as _Optional, TypeVar, Union
|
from collections.abc import Callable
|
||||||
|
from typing import Literal, Optional as _Optional, TypeVar, Union
|
||||||
from typing_extensions import ParamSpec
|
from typing_extensions import ParamSpec
|
||||||
|
|
||||||
import torch
|
import torch
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
# mypy: allow-untyped-defs
|
# mypy: allow-untyped-defs
|
||||||
from typing import Callable, Optional, Union
|
from collections.abc import Callable
|
||||||
|
from typing import Optional, Union
|
||||||
from typing_extensions import deprecated
|
from typing_extensions import deprecated
|
||||||
|
|
||||||
from torch import Tensor
|
from torch import Tensor
|
||||||
|
@ -6,8 +6,8 @@ import itertools
|
|||||||
import warnings
|
import warnings
|
||||||
import weakref
|
import weakref
|
||||||
from collections import namedtuple, OrderedDict
|
from collections import namedtuple, OrderedDict
|
||||||
from collections.abc import Iterator, Mapping
|
from collections.abc import Callable, Iterator, Mapping
|
||||||
from typing import Any, Callable, Optional, overload, TypeVar, Union
|
from typing import Any, Optional, overload, TypeVar, Union
|
||||||
from typing_extensions import Self
|
from typing_extensions import Self
|
||||||
|
|
||||||
import torch
|
import torch
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
# mypy: allow-untyped-defs
|
# mypy: allow-untyped-defs
|
||||||
import copy
|
import copy
|
||||||
import warnings
|
import warnings
|
||||||
from typing import Any, Callable, Optional, Union
|
from collections.abc import Callable
|
||||||
|
from typing import Any, Optional, Union
|
||||||
|
|
||||||
import torch
|
import torch
|
||||||
import torch.nn.functional as F
|
import torch.nn.functional as F
|
||||||
|
@ -9,10 +9,11 @@ import sys
|
|||||||
import warnings
|
import warnings
|
||||||
import weakref
|
import weakref
|
||||||
from collections import defaultdict, deque
|
from collections import defaultdict, deque
|
||||||
|
from collections.abc import Callable
|
||||||
from contextlib import contextmanager
|
from contextlib import contextmanager
|
||||||
from dataclasses import dataclass, fields, is_dataclass
|
from dataclasses import dataclass, fields, is_dataclass
|
||||||
from enum import auto, Enum
|
from enum import auto, Enum
|
||||||
from typing import Any, Callable, Optional, TYPE_CHECKING
|
from typing import Any, Optional, TYPE_CHECKING
|
||||||
|
|
||||||
import torch
|
import torch
|
||||||
import torch.distributed as dist
|
import torch.distributed as dist
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import importlib
|
import importlib
|
||||||
import warnings
|
import warnings
|
||||||
from typing import Callable
|
from collections.abc import Callable
|
||||||
|
|
||||||
|
|
||||||
_MESSAGE_TEMPLATE = (
|
_MESSAGE_TEMPLATE = (
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
from typing import Any, Callable, TypeVar
|
from collections.abc import Callable
|
||||||
|
from typing import Any, TypeVar
|
||||||
from typing_extensions import ParamSpec
|
from typing_extensions import ParamSpec
|
||||||
|
|
||||||
import torch
|
import torch
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
# mypy: allow-untyped-defs
|
# mypy: allow-untyped-defs
|
||||||
import functools
|
import functools
|
||||||
|
from collections.abc import Callable
|
||||||
from contextlib import contextmanager
|
from contextlib import contextmanager
|
||||||
from typing import Callable
|
|
||||||
|
|
||||||
import torch
|
import torch
|
||||||
from torch._decomp import decomposition_table
|
from torch._decomp import decomposition_table
|
||||||
|
@ -4,8 +4,9 @@ import functools
|
|||||||
import types
|
import types
|
||||||
import typing
|
import typing
|
||||||
import warnings
|
import warnings
|
||||||
from typing import Callable, cast, Optional, TypeVar, Union
|
from collections.abc import Callable
|
||||||
from typing_extensions import deprecated, ParamSpec, TypeAlias
|
from typing import cast, Optional, TypeAlias, TypeVar, Union
|
||||||
|
from typing_extensions import deprecated, ParamSpec
|
||||||
|
|
||||||
import torch
|
import torch
|
||||||
from torch import Tensor
|
from torch import Tensor
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import warnings
|
import warnings
|
||||||
from collections.abc import Iterable
|
from collections.abc import Callable, Iterable
|
||||||
from typing import Any, Callable, NamedTuple, Optional, overload, TypeVar, Union
|
from typing import Any, NamedTuple, Optional, overload, TypeVar, Union
|
||||||
from typing_extensions import Self
|
from typing_extensions import Self
|
||||||
|
|
||||||
import torch
|
import torch
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
# mypy: allow-untyped-defs
|
# mypy: allow-untyped-defs
|
||||||
import sys
|
import sys
|
||||||
from collections.abc import Iterable
|
from collections.abc import Callable, Iterable
|
||||||
from typing import Any, Callable
|
from typing import Any
|
||||||
|
|
||||||
|
|
||||||
__all__ = ["trace_dependencies"]
|
__all__ = ["trace_dependencies"]
|
||||||
|
@ -8,12 +8,12 @@ import pickletools
|
|||||||
import platform
|
import platform
|
||||||
import types
|
import types
|
||||||
from collections import defaultdict, OrderedDict
|
from collections import defaultdict, OrderedDict
|
||||||
from collections.abc import Sequence
|
from collections.abc import Callable, Sequence
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
from importlib.machinery import SourceFileLoader
|
from importlib.machinery import SourceFileLoader
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Any, Callable, cast, IO, Optional, Union
|
from typing import Any, cast, IO, Optional, Union
|
||||||
|
|
||||||
import torch
|
import torch
|
||||||
from torch.serialization import location_tag, normalize_storage_type
|
from torch.serialization import location_tag, normalize_storage_type
|
||||||
|
@ -8,9 +8,9 @@ import linecache
|
|||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import types
|
import types
|
||||||
from collections.abc import Iterable
|
from collections.abc import Callable, Iterable
|
||||||
from contextlib import contextmanager
|
from contextlib import contextmanager
|
||||||
from typing import Any, Callable, cast, Optional, TYPE_CHECKING, Union
|
from typing import Any, cast, Optional, TYPE_CHECKING, Union
|
||||||
from weakref import WeakValueDictionary
|
from weakref import WeakValueDictionary
|
||||||
|
|
||||||
import torch
|
import torch
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import base64
|
import base64
|
||||||
import zlib
|
import zlib
|
||||||
from collections.abc import Iterable
|
from collections.abc import Callable, Iterable
|
||||||
from typing import Callable, Generic, TypeVar
|
from typing import Generic, TypeVar
|
||||||
|
|
||||||
|
|
||||||
T = TypeVar("T")
|
T = TypeVar("T")
|
||||||
|
@ -8,18 +8,10 @@ import os
|
|||||||
import pickle
|
import pickle
|
||||||
import tokenize
|
import tokenize
|
||||||
import unittest
|
import unittest
|
||||||
|
from collections.abc import Callable
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from types import FunctionType, ModuleType
|
from types import FunctionType, ModuleType
|
||||||
from typing import (
|
from typing import Any, Generic, NoReturn, Optional, TYPE_CHECKING, TypeVar, Union
|
||||||
Any,
|
|
||||||
Callable,
|
|
||||||
Generic,
|
|
||||||
NoReturn,
|
|
||||||
Optional,
|
|
||||||
TYPE_CHECKING,
|
|
||||||
TypeVar,
|
|
||||||
Union,
|
|
||||||
)
|
|
||||||
from typing_extensions import deprecated
|
from typing_extensions import deprecated
|
||||||
from unittest import mock
|
from unittest import mock
|
||||||
|
|
||||||
|
@ -6,7 +6,8 @@ import functools
|
|||||||
import inspect
|
import inspect
|
||||||
import sys
|
import sys
|
||||||
import warnings
|
import warnings
|
||||||
from typing import Any, Callable, cast, TypeVar
|
from collections.abc import Callable
|
||||||
|
from typing import Any, cast, TypeVar
|
||||||
|
|
||||||
|
|
||||||
# Used for annotating the decorator usage of _DecoratorContextManager (e.g.,
|
# Used for annotating the decorator usage of _DecoratorContextManager (e.g.,
|
||||||
|
@ -14,8 +14,8 @@ collection support for PyTorch APIs.
|
|||||||
|
|
||||||
import functools
|
import functools
|
||||||
import types
|
import types
|
||||||
from collections.abc import Iterable
|
from collections.abc import Callable, Iterable
|
||||||
from typing import Any, Callable, Optional, overload, TypeVar, Union
|
from typing import Any, Optional, overload, TypeVar, Union
|
||||||
from typing_extensions import deprecated, TypeIs
|
from typing_extensions import deprecated, TypeIs
|
||||||
|
|
||||||
import torch.utils._pytree as python_pytree
|
import torch.utils._pytree as python_pytree
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
from typing import Callable, TypeVar
|
from collections.abc import Callable
|
||||||
|
from typing import TypeVar
|
||||||
|
|
||||||
|
|
||||||
F = TypeVar("F")
|
F = TypeVar("F")
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
from typing import Optional
|
from typing import Optional, TypeAlias
|
||||||
from typing_extensions import TypeAlias
|
|
||||||
|
|
||||||
import torch
|
import torch
|
||||||
from torch import Tensor
|
from torch import Tensor
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import functools
|
import functools
|
||||||
from typing import Callable, TypeVar
|
from collections.abc import Callable
|
||||||
from typing_extensions import Concatenate, ParamSpec
|
from typing import Concatenate, TypeVar
|
||||||
|
from typing_extensions import ParamSpec
|
||||||
|
|
||||||
|
|
||||||
_P = ParamSpec("_P")
|
_P = ParamSpec("_P")
|
||||||
|
@ -24,11 +24,10 @@ import threading
|
|||||||
import types
|
import types
|
||||||
import warnings
|
import warnings
|
||||||
from collections import defaultdict, deque, namedtuple, OrderedDict
|
from collections import defaultdict, deque, namedtuple, OrderedDict
|
||||||
from collections.abc import Hashable, Iterable, Mapping, Sequence
|
from collections.abc import Callable, Hashable, Iterable, Mapping, Sequence
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
from typing import (
|
from typing import (
|
||||||
Any,
|
Any,
|
||||||
Callable,
|
|
||||||
cast,
|
cast,
|
||||||
ClassVar,
|
ClassVar,
|
||||||
Final,
|
Final,
|
||||||
|
@ -4,7 +4,8 @@
|
|||||||
import collections
|
import collections
|
||||||
import functools
|
import functools
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
from typing import Callable, TypeVar
|
from collections.abc import Callable
|
||||||
|
from typing import TypeVar
|
||||||
from typing_extensions import ParamSpec
|
from typing_extensions import ParamSpec
|
||||||
|
|
||||||
|
|
||||||
|
@ -6,9 +6,9 @@ import os
|
|||||||
import re
|
import re
|
||||||
import subprocess
|
import subprocess
|
||||||
import time
|
import time
|
||||||
from collections.abc import Sequence
|
from collections.abc import Callable, Sequence
|
||||||
from threading import Lock
|
from threading import Lock
|
||||||
from typing import Any, Callable, Optional, TypeVar
|
from typing import Any, Optional, TypeVar
|
||||||
from typing_extensions import ParamSpec
|
from typing_extensions import ParamSpec
|
||||||
|
|
||||||
|
|
||||||
|
@ -3,7 +3,8 @@ import functools
|
|||||||
import math
|
import math
|
||||||
import operator
|
import operator
|
||||||
import sys
|
import sys
|
||||||
from typing import Callable, Optional, SupportsFloat, TYPE_CHECKING, TypeVar, Union
|
from collections.abc import Callable
|
||||||
|
from typing import Optional, SupportsFloat, TYPE_CHECKING, TypeVar, Union
|
||||||
from typing_extensions import TypeVarTuple, Unpack
|
from typing_extensions import TypeVarTuple, Unpack
|
||||||
|
|
||||||
import sympy
|
import sympy
|
||||||
|
@ -7,17 +7,17 @@ import itertools
|
|||||||
import logging
|
import logging
|
||||||
import math
|
import math
|
||||||
import operator
|
import operator
|
||||||
|
from collections.abc import Callable
|
||||||
from typing import (
|
from typing import (
|
||||||
Callable,
|
|
||||||
Generic,
|
Generic,
|
||||||
Optional,
|
Optional,
|
||||||
overload,
|
overload,
|
||||||
SupportsFloat,
|
SupportsFloat,
|
||||||
TYPE_CHECKING,
|
TYPE_CHECKING,
|
||||||
|
TypeGuard,
|
||||||
TypeVar,
|
TypeVar,
|
||||||
Union,
|
Union,
|
||||||
)
|
)
|
||||||
from typing_extensions import TypeGuard
|
|
||||||
|
|
||||||
import sympy
|
import sympy
|
||||||
from sympy.logic.boolalg import Boolean as SympyBoolean, BooleanAtom
|
from sympy.logic.boolalg import Boolean as SympyBoolean, BooleanAtom
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
from typing import Callable, Generic, Optional, TypeVar
|
from collections.abc import Callable
|
||||||
|
from typing import Generic, Optional, TypeVar
|
||||||
|
|
||||||
|
|
||||||
R = TypeVar("R")
|
R = TypeVar("R")
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
from typing import Any, Callable
|
from typing import Any
|
||||||
|
from collections.abc import Callable
|
||||||
from typing_extensions import Protocol, runtime_checkable
|
from typing_extensions import Protocol, runtime_checkable
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
# mypy: allow-untyped-defs
|
# mypy: allow-untyped-defs
|
||||||
from typing import Any, Callable, cast, Optional, Union
|
from typing import Any, cast, Optional, Union
|
||||||
|
from collections.abc import Callable
|
||||||
|
|
||||||
import torch
|
import torch
|
||||||
import torch._dynamo
|
import torch._dynamo
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
# mypy: allow-untyped-defs
|
# mypy: allow-untyped-defs
|
||||||
import functools
|
import functools
|
||||||
import itertools as it
|
import itertools as it
|
||||||
from typing import Any, Callable, Optional, Union
|
from typing import Any, Optional, Union
|
||||||
|
from collections.abc import Callable
|
||||||
|
|
||||||
import torch
|
import torch
|
||||||
|
|
||||||
|
@ -2,7 +2,8 @@
|
|||||||
import enum
|
import enum
|
||||||
import timeit
|
import timeit
|
||||||
import textwrap
|
import textwrap
|
||||||
from typing import overload, Any, Callable, NoReturn, Optional, Union
|
from typing import overload, Any, NoReturn, Optional, Union
|
||||||
|
from collections.abc import Callable
|
||||||
|
|
||||||
import torch
|
import torch
|
||||||
from torch.utils.benchmark.utils import common, cpp_jit
|
from torch.utils.benchmark.utils import common, cpp_jit
|
||||||
|
@ -11,8 +11,9 @@ import subprocess
|
|||||||
import sys
|
import sys
|
||||||
import textwrap
|
import textwrap
|
||||||
from typing import (
|
from typing import (
|
||||||
cast, Any, Callable, NamedTuple,
|
cast, Any, NamedTuple,
|
||||||
Optional, Union, TYPE_CHECKING)
|
Optional, Union, TYPE_CHECKING)
|
||||||
|
from collections.abc import Callable
|
||||||
from collections.abc import Iterator
|
from collections.abc import Iterator
|
||||||
|
|
||||||
import torch
|
import torch
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
# mypy: allow-untyped-defs
|
# mypy: allow-untyped-defs
|
||||||
from typing import Any, TypeVar, Optional, NamedTuple, Union, Callable
|
from typing import Any, TypeVar, Optional, NamedTuple, Union
|
||||||
from collections.abc import Sequence
|
from collections.abc import Callable, Sequence
|
||||||
import textwrap
|
import textwrap
|
||||||
import torch
|
import torch
|
||||||
from torch._C import TupleType, ListType
|
from torch._C import TupleType, ListType
|
||||||
|
@ -12,7 +12,8 @@ import collections
|
|||||||
import contextlib
|
import contextlib
|
||||||
import copy
|
import copy
|
||||||
import re
|
import re
|
||||||
from typing import Callable, Optional, Union
|
from collections.abc import Callable
|
||||||
|
from typing import Optional, Union
|
||||||
|
|
||||||
import torch
|
import torch
|
||||||
|
|
||||||
|
@ -16,7 +16,8 @@ import os
|
|||||||
import queue
|
import queue
|
||||||
import threading
|
import threading
|
||||||
import warnings
|
import warnings
|
||||||
from typing import Any, Callable, Generic, Optional, TYPE_CHECKING, TypeVar, Union
|
from collections.abc import Callable
|
||||||
|
from typing import Any, Generic, Optional, TYPE_CHECKING, TypeVar, Union
|
||||||
from typing_extensions import Self
|
from typing_extensions import Self
|
||||||
|
|
||||||
import torch
|
import torch
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import functools
|
import functools
|
||||||
import pickle
|
import pickle
|
||||||
from collections.abc import Iterable, Iterator
|
from collections.abc import Callable, Iterable, Iterator
|
||||||
from typing import Callable, Optional, TypeVar
|
from typing import Optional, TypeVar
|
||||||
|
|
||||||
from torch.utils._import_utils import import_dill
|
from torch.utils._import_utils import import_dill
|
||||||
from torch.utils.data.datapipes._hook_iterator import _SnapshotState
|
from torch.utils.data.datapipes._hook_iterator import _SnapshotState
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
# mypy: allow-untyped-defs
|
# mypy: allow-untyped-defs
|
||||||
import functools
|
import functools
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
from collections.abc import Iterator, Sized
|
from collections.abc import Callable, Iterator, Sized
|
||||||
from typing import Any, Callable, Optional, TypeVar, Union
|
from typing import Any, Optional, TypeVar, Union
|
||||||
|
|
||||||
import torch
|
import torch
|
||||||
from torch.utils.data._utils.collate import default_collate
|
from torch.utils.data._utils.collate import default_collate
|
||||||
|
@ -3,8 +3,8 @@ import copy as copymodule
|
|||||||
import warnings
|
import warnings
|
||||||
from abc import ABC, abstractmethod
|
from abc import ABC, abstractmethod
|
||||||
from collections import deque
|
from collections import deque
|
||||||
from collections.abc import Iterator, Sized
|
from collections.abc import Callable, Iterator, Sized
|
||||||
from typing import Any, Callable, Literal, Optional, TypeVar
|
from typing import Any, Literal, Optional, TypeVar
|
||||||
|
|
||||||
from torch.utils.data.datapipes._decorator import functional_datapipe
|
from torch.utils.data.datapipes._decorator import functional_datapipe
|
||||||
from torch.utils.data.datapipes._hook_iterator import _SnapshotState
|
from torch.utils.data.datapipes._hook_iterator import _SnapshotState
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
# mypy: allow-untyped-defs
|
# mypy: allow-untyped-defs
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
from collections.abc import Iterator, Sized
|
from collections.abc import Callable, Iterator, Sized
|
||||||
from typing import Any, Callable, Optional, TypeVar
|
from typing import Any, Optional, TypeVar
|
||||||
|
|
||||||
from torch.utils.data.datapipes._decorator import functional_datapipe
|
from torch.utils.data.datapipes._decorator import functional_datapipe
|
||||||
from torch.utils.data.datapipes.datapipe import DataChunk, IterDataPipe
|
from torch.utils.data.datapipes.datapipe import DataChunk, IterDataPipe
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
from collections.abc import Iterable, Iterator, Sized
|
from collections.abc import Callable, Iterable, Iterator, Sized
|
||||||
from io import BufferedIOBase
|
from io import BufferedIOBase
|
||||||
from typing import Any, Callable
|
from typing import Any
|
||||||
|
|
||||||
from torch.utils.data.datapipes._decorator import functional_datapipe
|
from torch.utils.data.datapipes._decorator import functional_datapipe
|
||||||
from torch.utils.data.datapipes.datapipe import IterDataPipe
|
from torch.utils.data.datapipes.datapipe import IterDataPipe
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# mypy: allow-untyped-defs
|
# mypy: allow-untyped-defs
|
||||||
from collections.abc import Iterator
|
from collections.abc import Callable, Iterator
|
||||||
from typing import Callable, TypeVar
|
from typing import TypeVar
|
||||||
|
|
||||||
from torch.utils.data.datapipes._decorator import functional_datapipe
|
from torch.utils.data.datapipes._decorator import functional_datapipe
|
||||||
from torch.utils.data.datapipes.dataframe import dataframe_wrapper as df_wrapper
|
from torch.utils.data.datapipes.dataframe import dataframe_wrapper as df_wrapper
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
# mypy: allow-untyped-defs
|
# mypy: allow-untyped-defs
|
||||||
from typing import Callable, TypeVar
|
from collections.abc import Callable
|
||||||
|
from typing import TypeVar
|
||||||
|
|
||||||
from torch.utils.data.datapipes._decorator import functional_datapipe
|
from torch.utils.data.datapipes._decorator import functional_datapipe
|
||||||
from torch.utils.data.datapipes.datapipe import MapDataPipe
|
from torch.utils.data.datapipes.datapipe import MapDataPipe
|
||||||
|
@ -4,9 +4,9 @@ import functools
|
|||||||
import inspect
|
import inspect
|
||||||
import os
|
import os
|
||||||
import warnings
|
import warnings
|
||||||
from collections.abc import Iterable
|
from collections.abc import Callable, Iterable
|
||||||
from io import IOBase
|
from io import IOBase
|
||||||
from typing import Any, Callable, Optional, Union
|
from typing import Any, Optional, Union
|
||||||
|
|
||||||
from torch.utils._import_utils import dill_available
|
from torch.utils._import_utils import dill_available
|
||||||
|
|
||||||
|
@ -2,7 +2,8 @@
|
|||||||
import torch
|
import torch
|
||||||
from torch.utils._pytree import tree_map, tree_flatten, tree_unflatten
|
from torch.utils._pytree import tree_map, tree_flatten, tree_unflatten
|
||||||
from .module_tracker import ModuleTracker
|
from .module_tracker import ModuleTracker
|
||||||
from typing import Any, Optional, Union, TypeVar, Callable
|
from typing import Any, Optional, Union, TypeVar
|
||||||
|
from collections.abc import Callable
|
||||||
from collections.abc import Iterator
|
from collections.abc import Iterator
|
||||||
from typing_extensions import ParamSpec
|
from typing_extensions import ParamSpec
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
|
@ -9,8 +9,9 @@ This package is lazily initialized, so you can always import it, and use
|
|||||||
|
|
||||||
import threading
|
import threading
|
||||||
import traceback
|
import traceback
|
||||||
|
from collections.abc import Callable
|
||||||
from functools import lru_cache
|
from functools import lru_cache
|
||||||
from typing import Any, Callable, Optional, Union
|
from typing import Any, Optional, Union
|
||||||
|
|
||||||
import torch
|
import torch
|
||||||
import torch._C
|
import torch._C
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
from typing import Callable
|
from collections.abc import Callable
|
||||||
|
|
||||||
from torch._utils import CallbackRegistry
|
from torch._utils import CallbackRegistry
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user