Skip to content

Commit

Permalink
[Typing][B-50] Add type annotations for python/paddle/static/input.py
Browse files Browse the repository at this point in the history
  • Loading branch information
ooooo-create committed Aug 5, 2024
1 parent b3dfc0e commit e7d0910
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion python/paddle/static/input.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit e7d0910

Please sign in to comment.