
    Si                    X    S SK Jr  S SKrS SKrS SKJr  S SKJr  SS jr	 " S S\5      r
g)	    )annotationsN)Base)expectc                   U R                   nUc  [        [        U5      5      nOU Vs/ s H  ofS:  a  UOXe-   PM     nn[        U5      nUS-  UR                  :w  a  [        S5      e/ n[        U5       H  n	USS//-  nM     [        U5       H  n
XJ   nUS:  a  XV-   nX   XU-      /X'   M      US:X  a  [        R                  " U UUUS9$ [        R                  " U UUS9$ s  snf )Nr      z9The number of elements in raw_pads should be 2 * num_axesconstant)	pad_widthmodeconstant_values)r	   r
   )ndimlistrangelensize
ValueErrornppad)dataraw_padsr
   r   axes
input_rankaxisnum_axesr	   _is              ^/var/www/html/ai-image-ml/venv/lib/python3.13/site-packages/onnx/backend/test/case/node/pad.pypad_implr      s   J|E*%&EIJTT	t'88TJ4yH!|x}}$TUUI:q!fX	  8_w!8$D#;X(>?		  zvv+	
 	
 66 3 Ks   C%c                  d    \ rS rSr\SS j5       r\SS j5       r\SS j5       r\SS j5       rSr	g)	Pad2   c                    [         R                  R                  S/ SQS/SS9n [        R                  R                  SSSS	5      R                  [        R                  5      n[        R                  " / S
Q5      R                  [        R                  5      n[        R                  " S5      n[        XSS5      n[        XX#/U/SS9  g )Nr   )xpadsvalueyr   inputsoutputsr
               )r   r   r)   r*   r   r   r   r+   333333?test_constant_padr'   r(   nameonnxhelper	make_noder   randomrandnastypefloat32arrayint64r   r   )noder"   r#   r$   r%   s        r   export_constant_padPad.export_constant_pad3   s    {{$$03%j % 
 IIOOAq!Q'..rzz:xx0188HH
 

3Qj#.t,qc@ST    c            	        S H  n [         R                  R                  SSS/S/U S9n[        R                  R                  SSS	S
5      R                  [        R                  5      n[        R                  " / SQ5      R                  [        R                  5      n[        X#U 5      n[        XU/U/SU  S3S9  M     g )N)edgereflectwrapr   r"   r#   r%   r&   r)   r*   r+   r,   )r   r   r)   r)   r   r   r)   r)   test__padr/   )r2   r3   r4   r   r5   r6   r7   int32r9   r:   r   r   )r
   r;   r"   r#   r%   s        r   #export_reflection_edge_and_wrap_pad'Pad.export_reflection_edge_and_wrap_padA   s    /D;;((sFmcU ) D 		1a+22288<A8845<<D $'A4D	A3uTF$=OP 0r>   c                    [         R                  R                  S/ SQS/SS9n [        R                  R                  SSSS	5      R                  [        R                  5      n[        R                  " / S
Q5      R                  [        R                  5      n[        R                  " S5      n[        R                  " SS/[        R                  S9n[        UUSSSS/5      n[        U XX4/U/SS9  g )Nr   r"   r#   r$   r   r%   r   r&   r)   r*   r+   r,   r   r*   r   r+   r-   dtypetest_constant_pad_axesr/   r1   r;   r"   r#   r$   r   r%   s         r   export_constant_pad_axesPad.export_constant_pad_axesO   s    {{$$83%j % 
 IIOOAq!Q'..rzz:xx%,,HH
 

3xxAbhh/F
 	U)C)		
r>   c                    [         R                  R                  S/ SQS/SS9n [        R                  R                  SSSS	5      R                  [        R                  5      n[        R                  " / S
Q5      R                  [        R                  5      n[        R                  " S5      n[        R                  " SS/[        R                  S9n[        UUSSSS/5      n[        U XX4/U/SS9  g )Nr   rI   r%   r   r&   r)   r*   r+   r,   rJ   r-   rK   test_constant_pad_negative_axesr/   r1   rN   s         r   !export_constant_pad_negative_axes%Pad.export_constant_pad_negative_axesi   s    {{$$83%j % 
 IIOOAq!Q'..rzz:xx%,,HH
 

3xxR1H
 	U)C2		
r>    N)returnNone)
__name__
__module____qualname____firstlineno__staticmethodr<   rF   rO   rU   __static_attributes__rW   r>   r   r   r   2   sT    U U Q Q 
 
2 
 
r>   r   )g        N)
__future__r   numpyr   r2   onnx.backend.test.case.baser   onnx.backend.test.case.noder   r   r   rW   r>   r   <module>rd      s*    #   , ."JO
$ O
r>   