+
    –°³jE9  ã                  óÎ   € R t ^ RIHt ^ RIHt ^ RIt^ RIHtH	t
 ]'       d   ^ RIHt . ROt ! R R4      tR R	 ltR
 R ltR R ltR R ltR R ltR R ltRR/R R lltR# )a´  Python access to ATen's TensorIterator build pipeline.

:class:`TensorIterator` builds an iterator from a set of operands and flags
that mirror ``at::TensorIteratorConfig``, then exposes the post-build
shape / dtype / device / stride information for inspection.

This is a build-pipeline-only surface: there is no ``for_each`` here. Use it
to debug shape and dtype inference, validate custom-op contracts, or inspect
how ATen would lay out a kernel's iteration.

Construction is canonical, *not* a faithful replay of arbitrary
``TensorIteratorConfig`` call sequences. Operands are always registered in
the order ``outputs -> inputs -> const_inputs`` and setters are applied in
one fixed order. Notably:

* The C++ builder distinguishes ``add_input(a); add_const_input(b)`` from
  ``add_const_input(b); add_input(a)`` -- ``input(0)`` refers to different
  operands. This Python surface cannot express that distinction: every
  ``inputs[i]`` precedes every ``const_inputs[j]``.
* Some C++ setters have order-dependent side effects (e.g.
  ``promote_inputs_to_common_dtype(true)`` also flips
  ``check_all_same_dtype`` to ``false``). The Python surface materializes
  the *final* boolean state of each knob, not the call order, so it can't
  reproduce a sequence where an intermediate setter observed a
  since-overwritten value.

Every in-tree caller of ``at::TensorIteratorConfig`` fits the canonical-
recipe shape; the lossiness is theoretical, not practical.
)Úannotations)ÚTYPE_CHECKINGN)Ú_TensorIteratorÚ_TensorIteratorSpec)ÚSequenceÚTensorIteratorc            $      ó¨  € ] tR t^:tRtRRRRRRRRRRR	R
RR
RR
RR
RR
RRRRRR
RR
RRRRRRRR</R R llt]R R l4       t]R R l4       t]R R l4       t	]R R  l4       t
]R! R" l4       t]R# R$ l4       t]R% R& l4       t]R' R( l4       t]R) R* l4       tR+ R, ltR=R- R. lltR=R/ R0 lltR=R1 R2 lltR=R3 R4 lltR5 R6 ltR7 R8 ltR9 R: ltR;tR# )>r   aà  A built TensorIterator. Read-only view of the build-pipeline result.

Constructor kwargs mirror ``at::TensorIteratorConfig``; defaults match
the C++ defaults. See module docstring for canonical-recipe caveats.

Examples
--------
Build a TI for a binary op with type promotion and inspect the result::

    >>> import torch
    >>> from torch._tensor_iterator import TensorIterator
    >>> a = torch.zeros(3, 4, dtype=torch.float32)
    >>> b = torch.zeros(3, 4, dtype=torch.float64)
    >>> it = TensorIterator(
    ...     outputs=[None],
    ...     const_inputs=[a, b],
    ...     promote_inputs_to_common_dtype=True,
    ...     cast_common_dtype_to_outputs=True,
    ... )
    >>> it.common_dtype
    torch.float64
    >>> it.numel
    12
    >>> it.ndim       # contiguous (3, 4) collapses to a single dim
    1

Declare a static shape (the iterator skips broadcast/coalesce)::

    >>> a = torch.zeros(2, 6)
    >>> out = torch.empty(2, 6)
    >>> it = TensorIterator(
    ...     outputs=[out],
    ...     const_inputs=[a],
    ...     resize_outputs=False,
    ...     static_shape=(2, 6),
    ... )

Build a reduction TI (output must be pre-allocated to the reduced shape)::

    >>> a = torch.zeros(3, 4)
    >>> out = torch.empty(3, 1)
    >>> it = TensorIterator(
    ...     outputs=[out],
    ...     const_inputs=[a],
    ...     resize_outputs=False,
    ...     is_reduction=True,
    ... )

Inspect post-coalesce strides (in bytes; use ``element_strides`` for
element units)::

    >>> a = torch.zeros(3, 4)
    >>> b = torch.zeros(3, 4)
    >>> it = TensorIterator(outputs=[None], const_inputs=[a, b])
    >>> tuple(it.strides(0))           # output byte strides
    (4,)
    >>> it.element_strides(0)          # ... in elements
    (1,)
ÚoutputsNÚinputsÚconst_inputsÚcheck_all_same_dtypeTÚcheck_all_same_deviceÚpromote_inputs_to_common_dtypeFÚpromote_integer_inputs_to_floatÚcast_common_dtype_to_outputsÚenforce_safe_casting_to_outputÚenforce_linear_iterationÚresize_outputsÚcheck_mem_overlapÚallow_cpu_scalarsÚis_reductionÚstatic_dtypeÚstatic_deviceÚstatic_shapeÚsquash_dimsc          &     ód   € V ^8„  d   QhRRRRRRRRRRR	RR
RRRRRRRRRRRRRRRRRRRRRRRRR/# )é   r	   z list[torch.Tensor | None] | Noner
   zlist[torch.Tensor] | Noner   r   Úboolr   r   r   r   r   r   r   r   r   r   r   útorch.dtype | Noner   ztorch.device | Noner   zSequence[int] | Noner   zSequence[int]ÚreturnÚNone© )Úformats   "ÚW/home/luca/screen-checking/.venv/lib/python3.14/site-packages/torch/_tensor_iterator.pyÚ__annotate__ÚTensorIterator.__annotate__w   sÊ   € ÷ /4ñ /4ð 2ð/4ð *ð	/4ð
 0ð/4ð #ð/4ð  $ð/4ð )-ð/4ð *.ð/4ð '+ð/4ð )-ð/4ð #'ð/4ð ð/4ð  ð/4ð  ð/4ð  ð!/4ð" )ð#/4ð$ +ð%/4ð& +ð'/4ð( #ð)/4ð* 
ñ+/4ó    c               	óÖ  € \        4       pVe   \        V4      M. Vn        Ve   \        V4      M. Vn        Ve   \        V4      M. Vn        VVn        VVn        VVn        VVn        VVn	        V	Vn
        V
Vn        VVn        VVn        VVn        VVn        Ve   VVn        Ve   VVn        Ve!   \        V4      Vn        \        V4      Vn        VP)                  4       V n        R # ©N)Ú_CTensorIteratorSpecÚlistr	   r
   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   ÚbuildÚ_impl)Úselfr	   r
   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   Úspecs   &$$$$$$$$$$$$$$$$$$ r#   Ú__init__ÚTensorIterator.__init__w   sæ   € ô, $Ó%ˆØ(/Ò(;”t˜G”}ÀˆŒØ&,Ò&8”d˜6”l¸bˆŒØ2>Ò2JœD Ô.ÐPRˆÔà$8ˆÔ!Ø%:ˆÔ"Ø.LˆÔ+Ø/NˆÔ,Ø,HˆÔ)Ø.LˆÔ+Ø(@ˆÔ%Ø,ˆÔØ!2ˆÔØ!2ˆÔØ(ˆÔàÒ#Ø ,ˆDÔØÒ$Ø!.ˆDÔØÒ#Ü $ \Ó 2ˆDÔÜ# KÓ0ˆDÔà'+§z¡z£|ˆŽ
r&   c               ó   € V ^8„  d   QhRR/# ©r   r   Úintr!   )r"   s   "r#   r$   r%   ©   s   € ÷ ñ �cñ r&   c                	ó.   € V P                   P                  # r(   )r,   Úndim©r-   s   &r#   r5   ÚTensorIterator.ndim¨   s   € à�z‰z�‰Ðr&   c               ó   € V ^8„  d   QhRR/# )r   r   Ú
memoryviewr!   )r"   s   "r#   r$   r%   ­   s   € ÷  ñ  �zñ  r&   c                ó.   € V P                   P                  # )ai  Iterator shape (post coalesce/reorder), as a zero-copy
``memoryview`` of ``int64`` elements. The view holds a reference
to this iterator and keeps it alive for as long as the view is
reachable; copy via ``tuple(it.shape)`` if you need a snapshot
you can outlive the iterator with. Hot-path readers (dispatch
conditionals) get index access without an allocation.)r,   Úshaper6   s   &r#   r;   ÚTensorIterator.shape¬   s   € ð �z‰z×ÑÐr&   c               ó   € V ^8„  d   QhRR/# r2   r!   )r"   s   "r#   r$   r%   ·   s   € ÷  ñ  �sñ  r&   c                	ó.   € V P                   P                  # r(   )r,   Únumelr6   s   &r#   r?   ÚTensorIterator.numel¶   s   € à�z‰z×ÑÐr&   c               ó   € V ^8„  d   QhRR/# r2   r!   )r"   s   "r#   r$   r%   »   ó   € ÷ #ñ #˜#ñ #r&   c                	ó.   € V P                   P                  # r(   )r,   Úntensorsr6   s   &r#   rD   ÚTensorIterator.ntensorsº   ó   € à�z‰z×"Ñ"Ð"r&   c               ó   € V ^8„  d   QhRR/# r2   r!   )r"   s   "r#   r$   r%   ¿   s   € ÷ "ñ "˜ñ "r&   c                	ó.   € V P                   P                  # r(   )r,   Úninputsr6   s   &r#   rI   ÚTensorIterator.ninputs¾   s   € à�z‰z×!Ñ!Ð!r&   c               ó   € V ^8„  d   QhRR/# r2   r!   )r"   s   "r#   r$   r%   Ã   rB   r&   c                	ó.   € V P                   P                  # r(   )r,   Únoutputsr6   s   &r#   rM   ÚTensorIterator.noutputsÂ   rF   r&   c               ó   € V ^8„  d   QhRR/# ©r   r   r   r!   )r"   s   "r#   r$   r%   Ç   ó   € ÷ (ñ (˜tñ (r&   c                	ó.   € V P                   P                  # r(   )r,   Úis_contiguousr6   s   &r#   rS   ÚTensorIterator.is_contiguousÆ   ó   € à�z‰z×'Ñ'Ð'r&   c               ó   € V ^8„  d   QhRR/# rP   r!   )r"   s   "r#   r$   r%   Ë   rQ   r&   c                	ó.   € V P                   P                  # r(   )r,   Úis_trivial_1dr6   s   &r#   rX   ÚTensorIterator.is_trivial_1dÊ   rU   r&   c               ó   € V ^8„  d   QhRR/# )r   r   r   r!   )r"   s   "r#   r$   r%   Ï   s   € ÷ 'ñ 'Ð0ñ 'r&   c                ó.   € V P                   P                  # )a,  The inferred computation dtype, or ``None`` if no single dtype
was inferred. Populated whenever TensorIterator can resolve a
common dtype -- under promotion flags, or when every input
already shares a dtype. ``None`` does not mean "promotion was
not requested"; it means inference produced no answer.)r,   Úcommon_dtyper6   s   &r#   r\   ÚTensorIterator.common_dtypeÎ   s   € ð �z‰z×&Ñ&Ð&r&   c               ó    € V ^8„  d   QhRRRR/# ©r   Úindexr3   r   útorch.Tensorr!   )r"   s   "r#   r$   r%   ×   s   € ÷ (ñ (˜Cð ( Lñ (r&   c                ó8   € V P                   P                  V4      # )aL  Return the iterator's current operand at ``index``.

Note: under ``promote_inputs_to_common_dtype`` /
``cast_common_dtype_to_outputs`` (CPU paths), this may be a
promoted/cast kernel temporary rather than the tensor that was
registered with the config -- it's the iterator's view of the
operand a kernel would actually iterate over.)r,   Útensor©r-   r`   s   &&r#   rc   ÚTensorIterator.tensor×   s   € ð �z‰z× Ñ  Ó'Ð'r&   c               ó    € V ^8„  d   QhRRRR/# r_   r!   )r"   s   "r#   r$   r%   á   s   € ÷ 'ñ '˜3ð ' |ñ 'r&   c                ó8   € V P                   P                  V4      # )zZReturn the iterator's current input. See :meth:`tensor` for the
promoted-temporary caveat.)r,   Úinputrd   s   &&r#   rh   ÚTensorIterator.inputá   s   € ð �z‰z×Ñ Ó&Ð&r&   c               ó    € V ^8„  d   QhRRRR/# r_   r!   )r"   s   "r#   r$   r%   æ   s   € ÷ (ñ (˜Cð (¨ñ (r&   c                ó8   € V P                   P                  V4      # )zWReturn the iterator's current output. See :meth:`tensor` for the
cast-temporary caveat.)r,   Úoutputrd   s   &&r#   rl   ÚTensorIterator.outputæ   s   € ð �z‰z× Ñ  Ó'Ð'r&   c               ó    € V ^8„  d   QhRRRR/# )r   r`   r3   r   ztorch.dtyper!   )r"   s   "r#   r$   r%   ë   s   € ÷ 'ñ '˜3ð ' {ñ 'r&   c                	ó8   € V P                   P                  V4      # r(   )r,   Údtyperd   s   &&r#   rp   ÚTensorIterator.dtypeë   s   € Ø�z‰z×Ñ Ó&Ð&r&   c               ó    € V ^8„  d   QhRRRR/# )r   r`   r3   r   ztorch.devicer!   )r"   s   "r#   r$   r%   î   s   € ÷ (ñ (˜Cð (¨ñ (r&   c                	ó8   € V P                   P                  V4      # r(   )r,   Údevicerd   s   &&r#   rt   ÚTensorIterator.deviceî   s   € Ø�z‰z× Ñ  Ó'Ð'r&   c               ó    € V ^8„  d   QhRRRR/# )r   r`   r3   r   r9   r!   )r"   s   "r#   r$   r%   ñ   s   € ÷ )ñ )˜Sð ) Zñ )r&   c                ó8   € V P                   P                  V4      # )a+  Per-operand strides in bytes (post reorder/coalesce), as a
zero-copy ``memoryview`` of ``int64`` elements. The view holds a
reference to this iterator and keeps it alive for as long as the
view is reachable; copy via ``tuple(it.strides(i))`` if you need
a snapshot you can outlive the iterator with.)r,   Ústridesrd   s   &&r#   rx   ÚTensorIterator.stridesñ   s   € ð �z‰z×!Ñ! %Ó(Ð(r&   c               ó    € V ^8„  d   QhRRRR/# )r   r`   r3   r   ztuple[int, ...]r!   )r"   s   "r#   r$   r%   ù   s   € ÷ 1ñ 1 Sð 1¨_ñ 1r&   c                ó8   € V P                   P                  V4      # )zçPer-operand strides in elements (byte stride / element size).

Allocates a fresh tuple on every call. Don't use on a hot path:
cache the result, or read :meth:`strides` once and divide by
:meth:`element_size` of the operand inline.)r,   Úelement_stridesrd   s   &&r#   r|   ÚTensorIterator.element_stridesù   s   € ð �z‰z×)Ñ)¨%Ó0Ð0r&   c               ó   € V ^8„  d   QhRR/# )r   r   Ústrr!   )r"   s   "r#   r$   r%     s   € ÷  ñ  ˜#ñ  r&   c                	ó,   € \        V P                  4      # r(   )Úreprr,   r6   s   &r#   Ú__repr__ÚTensorIterator.__repr__  s   € Ü�D—J‘JÓÐr&   )r,   r!   )é    )Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r/   Úpropertyr5   r;   r?   rD   rI   rM   rS   rX   r\   rc   rh   rl   rp   rt   rx   r|   r‚   Ú__static_attributes__r!   r&   r#   r   r   :   s£  † ñ:ðx/4ð 59ð/4ð -1ð	/4ð
 37ð/4ð &*ð/4ð '+ð/4ð 05ð/4ð 16ð/4ð .3ð/4ð 05ð/4ð */ð/4ð  $ð/4ð #'ð/4ð #(ð/4ð  #ð!/4ð" ,0ð#/4ð$ .2ð%/4ð& .2ð'/4ð( &(÷)/4ðb ôó ðð ô ó ð ð ô ó ð ð ô#ó ð#ð ô"ó ð"ð ô#ó ð#ð ô(ó ð(ð ô(ó ð(ð ô'ó ð'õ(÷'÷
(÷
'÷(õ)õ1÷ ñ  r&   c               ó(   € V ^8„  d   QhRRRRRRRR/# ©r   Úoutútorch.Tensor | NoneÚara   Úbr   r   r!   )r"   s   "r#   r$   r$   
  s,   € ÷ ñ Ø	ðØ!-ðØ2>ðàñr&   c           	     ó(   € \        V .W.RRRRR7      # )z0Equivalent of ``at::TensorIterator::binary_op``.T)r	   r   r   r   r   r   ©r   ©rŽ   r�   r‘   s   &&&r#   Ú	binary_opr•   
  s'   € ô Ø�Ø�VØØ'+Ø%)Ø'+ôð r&   c               ó(   € V ^8„  d   QhRRRRRRRR/# r�   r!   )r"   s   "r#   r$   r$     s,   € ÷ ñ Ø	ðØ!-ðØ2>ðàñr&   c           
     ó*   € \        V .W.RRRRRR7      # )z6Equivalent of ``at::TensorIterator::binary_float_op``.T)r	   r   r   r   r   r   r   r“   r”   s   &&&r#   Úbinary_float_opr˜     s*   € ô Ø�Ø�VØØ'+Ø%)Ø'+Ø(,ôð r&   c               ó(   € V ^8„  d   QhRRRRRRRR/# r�   r!   )r"   s   "r#   r$   r$   '  s,   € ÷ ñ Ø	ðØ!-ðØ2>ðàñr&   c           	     ó¦   € V f   \         P                  MRpV RJ;'       d    V P                  \         P                  8g  p\        V .W.RRVVR7      # )a4  Equivalent of ``at::TensorIterator::comparison_op``.

When ``out`` is ``None``, the output dtype is forced to bool. When ``out``
is a defined non-bool tensor, the common dtype is cast back to its dtype
via ``cast_common_dtype_to_outputs``. The bool-output case skips that cast
as a performance optimization.
NT)r	   r   r   r   r   r   )Útorchr   rp   r   )rŽ   r�   r‘   r   Úcast_to_outputss   &&&  r#   Úcomparison_opr�   '  sT   € ð "%¢”5—:’:°$€LØ �o×AÐA¨#¯)©)´u·z±zÑ*A€OÜØ�Ø�VØØ'+Ø%4Ø!ôð r&   c               ó$   € V ^8„  d   QhRRRRRR/# ©r   rŽ   r�   r�   ra   r   r   r!   )r"   s   "r#   r$   r$   =  s"   € ÷ ;ñ ;Ð%ð ;¨,ð ;¸>ñ ;r&   c                ó    € \        V .V.R7      # )z/Equivalent of ``at::TensorIterator::unary_op``.)r	   r   r“   ©rŽ   r�   s   &&r#   Úunary_opr¢   =  s   € ä 3 %°q°cÔ:Ð:r&   c               ó$   € V ^8„  d   QhRRRRRR/# rŸ   r!   )r"   s   "r#   r$   r$   B  s"   € ÷ 	ñ 	Ð+ð 	°ð 	Àñ 	r&   c           	     ó(   € \        V .V.RRRRR7      # )z5Equivalent of ``at::TensorIterator::unary_float_op``.T)r	   r   r   r   r   r   r“   r¡   s   &&r#   Úunary_float_opr¥   B  s%   € äØ�Ø�SØ'+Ø%)Ø'+Ø(,ôð r&   c               ó    € V ^8„  d   QhRRRR/# )r   rŽ   ra   r   r   r!   )r"   s   "r#   r$   r$   N  s   € ÷ ñ �Lð  ^ñ r&   c                ó>   € V f   \        R4      h\        V .RRR7      # )z°Equivalent of ``at::TensorIterator::nullary_op``.

Unlike the binary/unary factories, ``out`` must be a defined tensor;
the C++ named constructor takes a non-undefined output.
zAnullary_op requires a defined output tensor; None is not allowed.F)r	   r   r   )Ú	TypeErrorr   )rŽ   s   &r#   Ú
nullary_opr©   N  s3   € ð ‚{ÜØOó
ð 	
ô Ø�Ø"Øôð r&   Úout2c               ó(   € V ^8„  d   QhRRRRRRRR/# )r   rŽ   ra   r�   rª   r�   r   r   r!   )r"   s   "r#   r$   r$   _  s0   € ÷ 2ñ 2Ø	ð2àð2ð ð	2ð
 ñ2r&   c          	     óL  € VEe   V P                   VP                   u;8X  d   VP                   8X  g5   M \        RV P                    RVP                    RVP                    24      hV P                  4       VP                  4       8w  d.   \        RV P                  4        RVP                  4        24      hV P                  VP                  8w  g$   V P	                  4       VP	                  4       8w  d   \        R4      h\        W.V.RRRRR	7      # \        V .V.RRRRR
7      # )a¡  Equivalent of ``at::TensorIterator::reduce_op``.

Pass ``out2`` for the two-output reduction overload (e.g. ``min`` returning
values + indices). The output tensor(s) must be pre-allocated and shaped
correctly: this factory does not allocate or resize. With ``out2``, both
outputs must live on ``a``'s device and share its sizes/strides -- the
C++ named constructor asserts this and the same checks are mirrored
here.
zAreduce_op: out, out2, and the input must share a device, got out=z, out2=z, a=z4reduce_op: out and out2 must have the same dim, got z and z=reduce_op: out and out2 must have identical sizes and stridesFT)r	   r   r   r   r   r   )r	   r   r   r   r   r   )rt   ÚRuntimeErrorÚdimr;   Ústrider   )rŽ   r�   rª   s   &&$r#   Ú	reduce_opr°   _  s  € ð( ÓØ�z‰z˜QŸX™XÖ4¨¯©Ö4ÜðØŸ:™:˜, g¨d¯k©k¨]¸$¸q¿x¹x¸jðJóð ð �7‰7‹9˜Ÿ™›
Ô"ÜØFØ—7‘7“9�+˜U 4§8¡8£: ,ð0óð ð �9‰9˜Ÿ
™
Ô" c§j¡j£l°d·k±k³mÔ&CÜØOóð ô Ø�KØ˜Ø!&Ø Ø#Øô
ð 	
ô Ø�Ø�SØ'+ØØØôð r&   )r   r•   r˜   r�   r¢   r¥   r©   r°   )r‰   Ú
__future__r   Útypingr   r›   Útorch._Cr   Ú_CTensorIteratorr   r)   Úcollections.abcr   Ú__all__r   r•   r˜   r�   r¢   r¥   r©   r°   r!   r&   r#   Ú<module>r·      sh   ðñõ< #å  ã ÷÷ Ý(ò	€÷H ñ H õ`õõõ,;õ
	õð"2ð !%÷	2ñ 2r&   