diff --git a/python/paddle/reader/decorator.py b/python/paddle/reader/decorator.py index cbda11e0375ba..370910cae8bfb 100644 --- a/python/paddle/reader/decorator.py +++ b/python/paddle/reader/decorator.py @@ -28,7 +28,6 @@ Any, Callable, Generator, - Sequence, TypedDict, TypeVar, overload, @@ -39,6 +38,7 @@ from paddle.base.reader import QUEUE_GET_TIMEOUT if TYPE_CHECKING: + from collections.abc import Sequence class _ComposeOptions(TypedDict): check_alignment: NotRequired[bool] diff --git a/python/paddle/sparse/nn/functional/conv.py b/python/paddle/sparse/nn/functional/conv.py index a00385313f521..aec6d953c4cf9 100644 --- a/python/paddle/sparse/nn/functional/conv.py +++ b/python/paddle/sparse/nn/functional/conv.py @@ -14,7 +14,7 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Literal, Sequence +from typing import TYPE_CHECKING, Literal __all__ = [] @@ -27,6 +27,8 @@ from ...binary import add if TYPE_CHECKING: + from collections.abc import Sequence + from paddle import Tensor from paddle._typing import ( DataLayout2D, diff --git a/python/paddle/sparse/nn/layer/conv.py b/python/paddle/sparse/nn/layer/conv.py index e103b1db7021b..0f4126ae35a10 100644 --- a/python/paddle/sparse/nn/layer/conv.py +++ b/python/paddle/sparse/nn/layer/conv.py @@ -14,7 +14,7 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Literal, Sequence +from typing import TYPE_CHECKING, Literal import numpy as np @@ -26,6 +26,8 @@ from .. import functional as F if TYPE_CHECKING: + from collections.abc import Sequence + from paddle import Tensor from paddle._typing import ( ParamAttrLike, diff --git a/python/paddle/sparse/unary.py b/python/paddle/sparse/unary.py index 88fffae0357ed..f18e50d56e807 100644 --- a/python/paddle/sparse/unary.py +++ b/python/paddle/sparse/unary.py @@ -14,7 +14,7 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Sequence +from typing import TYPE_CHECKING import numpy as np @@ -31,6 +31,8 @@ from paddle.framework import LayerHelper if TYPE_CHECKING: + from collections.abc import Sequence + from paddle import Tensor from paddle._typing import DTypeLike, ShapeLike diff --git a/python/paddle/tensor/array.py b/python/paddle/tensor/array.py index 6b0733e0bd71b..f4cd3e174da62 100644 --- a/python/paddle/tensor/array.py +++ b/python/paddle/tensor/array.py @@ -15,7 +15,7 @@ # Define functions about array. from __future__ import annotations -from typing import Any, Sequence, TypeVar, overload +from typing import TYPE_CHECKING, Any, TypeVar, overload import paddle from paddle import _typing @@ -25,6 +25,9 @@ from ..common_ops_import import Variable from ..framework import LayerHelper, core, in_dynamic_mode +if TYPE_CHECKING: + from collections.abc import Sequence + __all__ = [] T = TypeVar("T") diff --git a/python/paddle/tensor/creation.py b/python/paddle/tensor/creation.py index 59bf9c99a3d40..983d055b87f68 100644 --- a/python/paddle/tensor/creation.py +++ b/python/paddle/tensor/creation.py @@ -16,7 +16,7 @@ import math import re -from typing import TYPE_CHECKING, Any, Sequence, overload +from typing import TYPE_CHECKING, Any, overload import numpy as np import numpy.typing as npt @@ -48,6 +48,8 @@ ) if TYPE_CHECKING: + from collections.abc import Sequence + from paddle._typing import ( DTypeLike, NestedNumbericSequence, diff --git a/python/paddle/tensor/einsum.py b/python/paddle/tensor/einsum.py index 297d61fa1f901..1bb7af045381d 100644 --- a/python/paddle/tensor/einsum.py +++ b/python/paddle/tensor/einsum.py @@ -17,7 +17,7 @@ import itertools import re import string -from typing import TYPE_CHECKING, NamedTuple, Sequence +from typing import TYPE_CHECKING, NamedTuple import numpy as np import opt_einsum @@ -35,6 +35,8 @@ ) if TYPE_CHECKING: + from collections.abc import Sequence + from paddle import Tensor __all__ = [] diff --git a/python/paddle/tensor/linalg.py b/python/paddle/tensor/linalg.py index e72587c8c6637..77f2eca520aff 100644 --- a/python/paddle/tensor/linalg.py +++ b/python/paddle/tensor/linalg.py @@ -13,7 +13,7 @@ # limitations under the License. from __future__ import annotations -from typing import TYPE_CHECKING, Literal, Sequence, overload +from typing import TYPE_CHECKING, Literal, overload import numpy as np from typing_extensions import TypeAlias @@ -42,6 +42,8 @@ from .math import _get_reduce_axis if TYPE_CHECKING: + from collections.abc import Sequence + from paddle import Tensor _POrder: TypeAlias = Literal['fro', 'nuc'] diff --git a/python/paddle/tensor/manipulation.py b/python/paddle/tensor/manipulation.py index 7a224eec3e208..34ce5de967835 100644 --- a/python/paddle/tensor/manipulation.py +++ b/python/paddle/tensor/manipulation.py @@ -15,7 +15,7 @@ from __future__ import annotations import math -from typing import TYPE_CHECKING, Any, Callable, Literal, Sequence, overload +from typing import TYPE_CHECKING, Any, Literal, overload import numpy as np @@ -43,6 +43,8 @@ from .creation import _complex_to_real_dtype, _real_to_complex_dtype, zeros if TYPE_CHECKING: + from collections.abc import Callable, Sequence + from paddle import Tensor from paddle._typing import ( DTypeLike,