Skip to content

Commit b4e3e9f

Browse files
authored
[Typing][C-17] Add type annotations for python/paddle/distributed/communication/gather.py (#66276)
1 parent 054262f commit b4e3e9f

File tree

1 file changed

+16
-1
lines changed
  • python/paddle/distributed/communication

1 file changed

+16
-1
lines changed

python/paddle/distributed/communication/gather.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,26 @@
1313
# limitations under the License.
1414

1515

16+
from __future__ import annotations
17+
18+
from typing import TYPE_CHECKING
19+
1620
from paddle import framework
1721
from paddle.distributed.communication import stream
1822

23+
if TYPE_CHECKING:
24+
from paddle import Tensor
25+
from paddle.base.core import task
26+
from paddle.distributed.communication.group import Group
27+
1928

20-
def gather(tensor, gather_list=None, dst=0, group=None, sync_op=True):
29+
def gather(
30+
tensor: Tensor,
31+
gather_list: list[Tensor] = None,
32+
dst: int = 0,
33+
group: Group | None = None,
34+
sync_op: bool = True,
35+
) -> task | None:
2136
"""
2237
2338
Gather tensors from all participators.

0 commit comments

Comments
 (0)