Ë
    ~\;jy  ã                   óP   — d Z ddlZddlmZ g d¢Z ed¬«      dd„«       Zd	„ Zd
„ Zy)zM
Required functions for optimized contractions of numpy arrays using theano.
é    Né   )Úto_backend_cache_wrap)Ú	to_theanoÚbuild_expressionÚevaluate_constantsT)Ú	constantsc                 ó  — ddl }t        | t        j                  «      r`|r|j                  j                  | «      S  |j                  j                  | j                  dgt        | j                  «      z  ¬«      «       S | S )zDConvert a numpy array to ``theano.tensor.TensorType`` instance.
    r   NF)ÚdtypeÚbroadcastable)
ÚtheanoÚ
isinstanceÚnpÚndarrayÚtensorÚconstantÚ
TensorTyper
   ÚlenÚshape)Úarrayr   r   s      úcG:\00. PROJECTS\API\Inventory\templateJSON\kerjaOCR\Lib\site-packages\opt_einsum/backends/theano.pyr   r      si   € ó ä�%œŸ™Ô$ÙØ—=‘=×)Ñ)¨%Ó0Ð0àdˆv�}‰}×'Ñ'¨e¯k©kÈ%ÈÔSVÐW\×WbÑWbÓScÑIcÐ'ÓdÓfÐfà€Ló    c                 ó  ‡‡	— ddl Š	| D �cg c]  }t        |«      ‘Œ }}|j                  |d¬«      }|D �cg c]%  }t        |‰	j                  j
                  «      rŒ$|‘Œ' }}‰	j                  ||«      Šˆˆ	fd„}|S c c}w c c}w )z>Build a theano function based on ``arrays`` and ``expr``.
    r   Nr   )Úbackendc            	      óv   •—  ‰| D �cg c]%  }t        |‰j                  j                  «      rŒ$|‘Œ' c}Ž S c c}w )N)r   r   ÚTensorConstant)ÚarraysÚxÚgraphr   s     €€r   Útheano_contractz)build_expression.<locals>.theano_contract'   s3   ø€ Ù¡&Ó\¡&˜Q´
¸1¸f¿m¹m×>ZÑ>ZÕ0[’q &Ñ\Ð]Ð]ùÒ\s   ˆ%6®6)r   r   Ú	_contractr   r   r   Úfunction)
r   Úexprr   Úin_varsÚout_varr   Ú	graph_insr   r   r   s
           @@r   r   r      s…   ù€ ó á-3Ó4©V EŒy˜Õ¨V€GÐ4Ø�n‰n˜W¨hˆnÓ7€Gñ $ÓW™G�q¬:°a¸¿¹×9UÑ9UÕ+V’˜G€IÐWØ�O‰O˜I wÓ/€Eõ^ð Ðùò 5ùò Xs   ‹A<¶%BÁBc                 óÂ   — | D �cg c]  }t        |d¬«      ‘Œ } } || dddœŽ\  }}|D �cg c]!  }|€d nt        |j                  «       d¬«      ‘Œ# }}||fS c c}w c c}w )NT)r   r   )r   r   )r   Úeval)Úconst_arraysr"   r   Únew_opsÚnew_contraction_lists        r   r   r   -   sz   € á9EÓF¹°A”I˜a¨$Ö/¸€LÐFÙ$(¨,ÀÐ]aÒ$bÑ!€GÐ!ñ SZÓZÑRYÈQ�q�y‰t¤i°·±³À4Ô&HÑHÐRY€GÐZàÐ(Ð(Ð(ùò Gùò [s
   …A«&A)F)	Ú__doc__Únumpyr   Úsharingr   Ú__all__r   r   r   © r   r   Ú<module>r0      s:   ðñó å +â
A€ñ  Ô&òó 'ðòó$)r   