Skip to content

Commit 987e933

Browse files
gsq7474741SigureMo
authored andcommitted
[Typing][A-54,A-55,A-56] Add type annotations for paddle/nn/functional/{activation.py, common.py, conv.py} (PaddlePaddle#65191)
--------- Co-authored-by: SigureMo <[email protected]>
1 parent 5c991f7 commit 987e933

File tree

6 files changed

+367
-172
lines changed

6 files changed

+367
-172
lines changed

python/paddle/_typing/basic.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,16 @@
1313
# limitations under the License.
1414
from __future__ import annotations
1515

16-
from typing import TYPE_CHECKING, Any, List, Sequence, Tuple, TypeVar, Union
16+
from typing import (
17+
TYPE_CHECKING,
18+
Any,
19+
List,
20+
Literal,
21+
Sequence,
22+
Tuple,
23+
TypeVar,
24+
Union,
25+
)
1726

1827
import numpy as np
1928
import numpy.typing as npt
@@ -44,3 +53,5 @@
4453
NumbericSequence = Sequence[Numberic]
4554
NestedNumbericSequence: TypeAlias = NestedSequence[Numberic]
4655
TensorOrTensors: TypeAlias = Union["Tensor", Sequence["Tensor"]]
56+
57+
PaddingMode: TypeAlias = Literal['valid', 'same', 'VALID', 'SAME']

python/paddle/_typing/layout.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
# Note: Do not confrom to predefined naming style in pylint.
2121
DataLayout0D: TypeAlias = Literal["NC"]
2222
DataLayout1D: TypeAlias = Literal["NCL", "NLC"]
23-
DataLayout2D: TypeAlias = Literal["NCHW", "NHCW"]
23+
DataLayout2D: TypeAlias = Literal["NCHW", "NHWC"]
2424
DataLayout3D: TypeAlias = Literal["NCDHW", "NDHWC"]
2525

2626
DataLayoutND: TypeAlias = Union[

0 commit comments

Comments
 (0)