From e7d091023687dbc3842138141fc085c5fbe6c842 Mon Sep 17 00:00:00 2001 From: ooooo <3164076421@qq.com> Date: Mon, 5 Aug 2024 10:10:56 +0800 Subject: [PATCH] [Typing][B-50] Add type annotations for python/paddle/static/input.py --- python/paddle/static/input.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/python/paddle/static/input.py b/python/paddle/static/input.py index 763608bec3ce6a..91be8eac6fe626 100644 --- a/python/paddle/static/input.py +++ b/python/paddle/static/input.py @@ -39,6 +39,8 @@ from ..base.variable_index import _setitem_static if TYPE_CHECKING: + from collections.abc import Sequence + from paddle import Tensor from paddle._typing import DTypeLike, ShapeLike, Size1 @@ -419,7 +421,11 @@ def __ne__(self, other) -> bool: return not self == other -def setitem(x, index, value): +def setitem( + x: Tensor, + index: int | slice | Sequence[int] | Tensor | None, + value: Tensor | npt.NDArray[Any] | bool | complex, +) -> Tensor: """ x(Tensor): input Tensor. index(Scalar|Tuple|List|Tensor): Where should be set value.