
     Tip                        S SK Jr  S SKrS SKrS SKJr  S SKJrJr  \R                  " \
5      rS rS rS rS rS
S	 jr \" \" \\\5      \" \\\5      /5      rg)    )annotationsN)ir)RewriteRuleRewriteRuleSetc                    U R                  U[        R                  R                  S9nU R	                  X2S9nU R                  U[        R                  R
                  S9$ )NtoaxisCastonnxTensorProtoFLOATSoftmaxFLOAT16)opinputr   upcastsoftmaxs        f/var/www/html/ai-image-ml/venv/lib/python3.13/site-packages/onnxscript/rewriter/ort_fusions/softmax.pysoftmax_with_fp32_upcastr      sO    WWUt//55W6Fjjj+G777t//77788    c                     U R                  XS9$ )Nr
   r   )r   r   r   s      r   r   r      s    ::e:''r   c                    U R                  U[        R                  R                  S9nU R	                  U5      nU R                  U[        R                  R
                  S9$ )Nr   r   )r   r   r   r   s       r   %softmax_with_fp32_upcast_without_axisr      sM    WWUt//55W6Fjj G777t//77788r   c                $    U R                  U5      $ )Nr   )r   r   s     r   softmax_without_axisr      s    ::er   c                    Uc  [         R                  S5        gUR                  [        R                  R
                  :H  $ )NzgCannot perform softmax upcast removal: cannot retrieve match_bindings for 'input' for dtype validation.F)loggerwarningdtyper   DataTyper   )contextr   _s      r   check_if_fp16_inputr'   #   s7    }O	
 ;;"++----r   )returnbool)
__future__r   loggingr   
onnxscriptr   !onnxscript.rewriter._rewrite_ruler   r   	getLogger__name__r!   r   r   r   r   r'   rules r   r   <module>r2      st    #    I			8	$9(9. 	,g7JK1 	
		r   