+
    ˜°³jã	  ã                   óŠ   € ^ RI Ht ^ RIHt ^ RIHt ^ RIHtHt R.t	]! R4      t
]! R4       ! R R]],          4      4       tR	# )
é    )ÚSized)ÚTypeVar)Úfunctional_datapipe)Ú	DataChunkÚMapDataPipeÚBatcherMapDataPipeÚ_TÚbatchc                   óz   a a€ ] tR t^t oRtR]3V3R lV 3R llltV3R lR ltV3R lR ltV3R	 lt	R
t
VtV ;t# )r   ax  
Create mini-batches of data (functional name: ``batch``).

An outer dimension will be added as ``batch_size`` if ``drop_last`` is set to ``True``,
or ``length % batch_size`` for the last batch if ``drop_last`` is set to ``False``.

Args:
    datapipe: Iterable DataPipe being batched
    batch_size: The size of each batch
    drop_last: Option to drop the last batch if it's not full

Example:
    >>> # xdoctest: +SKIP
    >>> from torchdata.datapipes.map import SequenceWrapper
    >>> dp = SequenceWrapper(range(10))
    >>> batch_dp = dp.batch(batch_size=2)
    >>> list(batch_dp)
    [[0, 1], [2, 3], [4, 5], [6, 7], [8, 9]]
Fc          
      óV   <€ V ^8„  d   QhRS[ S[,          RS[RS[RS[S[,          RR/# )é   ÚdatapipeÚ
batch_sizeÚ	drop_lastÚwrapper_classÚreturnN)r   r	   ÚintÚboolÚtyper   )ÚformatÚ__classdict__s   "€Úh/home/luca/screen-checking/.venv/lib/python3.14/site-packages/torch/utils/data/datapipes/map/grouping.pyÚ__annotate__ÚBatcherMapDataPipe.__annotate__)   sE   ø€ ÷ +ñ +á™b•/ð+ñ ð+ñ ð	+ñ
 ™I•ð+ð 
ñ+ó    c                óx   <€ V^ 8:  d   \        R4      h\        SV `	  4        Wn        W n        W0n        W@n        R# )r   z+Batch size is required to be larger than 0!N)ÚAssertionErrorÚsuperÚ__init__r   r   r   r   )Úselfr   r   r   r   Ú	__class__s   &&&&&€r   r   ÚBatcherMapDataPipe.__init__)   s8   ø€ ð ˜Œ?Ü Ð!NÓOÐOÜ‰ÑÔØ ŒØ$ŒØ"ŒØ*Ör   c                ó    <€ V ^8„  d   QhRS[ /# ©r   r   )r   )r   r   s   "€r   r   r   8   s   ø€ ÷ 
Kñ 
K¡Iñ 
Kr   c                ó‚  a € . p\        VS P                  ,          V^,           S P                  ,          4      p VP                  V 3R lV 4       4       S P                  V4      #   \         dN   pS P
                  '       g'   \        T4      ^ 8”  d   S P                  T4      u Rp?# \	        RT R24      ThRp?ii ; i)é   c              3   óJ   <"  € T F  pSP                   V,          x € K  	  R # 5i)N)r   )Ú.0Úir    s   & €r   Ú	<genexpr>Ú1BatcherMapDataPipe.__getitem__.<locals>.<genexpr><   s   øé € Ð;±7¨a˜Ÿ™ q×)Ò)³7ùs   ƒ #NzIndex z is out of bound.)Úranger   Úextendr   Ú
IndexErrorr   Úlen)r    Úindexr
   ÚindicesÚes   f&   r   Ú__getitem__ÚBatcherMapDataPipe.__getitem__8   s    ø€ ØˆÜ˜ §¡Õ/°%¸!µ)¸t¿¹Õ1NÓOˆð	KØ�L‰LÔ;±7Ó;Ô;Ø×%Ñ% eÓ,Ð,øÜô 	KØ—>—>�>¤c¨%£j°1¤nØ×)Ñ)¨%Ó0Õ0ä  6¨%¨Ð0AÐ!BÓCÈÐJûð		Kús#   º+A& Á&B>Á12B9Â#B>Â)B9Â9B>c                ó    <€ V ^8„  d   QhRS[ /# r$   )r   )r   r   s   "€r   r   r   D   s   ø€ ÷ Yñ Y™ñ Yr   c                óp  € \        V P                  \        4      '       dw   V P                  '       d'   \	        V P                  4      V P
                  ,          # \	        V P                  4      V P
                  ,           ^,
          V P
                  ,          # \        \        V 4      P                   R24      h)r&   z# instance doesn't have valid length)	Ú
isinstancer   r   r   r/   r   Ú	TypeErrorr   Ú__name__)r    s   &r   Ú__len__ÚBatcherMapDataPipe.__len__D   sx   € ä�d—m‘m¤U×+Ò+Ø�~�~ˆ~Ü˜4Ÿ=™=Ó)¨T¯_©_Õ<Ð<ä˜DŸM™MÓ*¨T¯_©_Õ<¸qÕ@ÀTÇ_Á_ÕTÐTäœt D›z×2Ñ2Ð3Ð3VÐWÓXÐXr   c                ó>   <€ V ^8„  d   Qh/ S[ ;R&   S[;R&   S[;R&   # )r   r   r   r   )r   r   r   )r   r   s   "€r   r   r      s*   ø‡ ‚ ñ, Ññ- ñ. �Oñ/ ñ0 �Oò1 r   )r   r   r   r   )r9   Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   r   r3   r:   Ú__annotate_func__Ú__static_attributes__Ú__classdictcell__Ú__classcell__)r!   r   s   @@r   r   r      s<   ù‡ € ñð8  Ø)2÷+õ +÷
Kð 
K÷Yð Y÷k … r   N)Úcollections.abcr   Útypingr   Ú%torch.utils.data.datapipes._decoratorr   Ú#torch.utils.data.datapipes.datapiper   r   Ú__all__r	   r   © r   r   Ú<module>rK      sN   ðå !Ý å Eß Fð  Ð
 €ñ ˆTƒ]€ñ �WÓô<Y˜ YÕ/ó <Yó ò<Yr   