Skip to content

Commit 483d9d9

Browse files
CaogrationSigureMo
andauthored
[Typing][B-92] Add type annotations for python/paddle/batch.py (#66295)
--------- Co-authored-by: Nyakku Shigure <sigure.qaq@gmail.com>
1 parent 0a9cdd4 commit 483d9d9

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

python/paddle/batch.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,19 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
from __future__ import annotations
16+
17+
from typing import Callable, Generator, TypeVar
18+
19+
_T = TypeVar('_T')
1520
__all__ = []
1621

1722

18-
def batch(reader, batch_size, drop_last=False):
23+
def batch(
24+
reader: Callable[[], Generator[_T, None, None]],
25+
batch_size: int,
26+
drop_last: bool = False,
27+
) -> Callable[[], Generator[list[_T], None, None]]:
1928
"""
2029
This operator creates a batched reader which combines the data from the
2130
input reader to batched data.

0 commit comments

Comments
 (0)