
    h                     L    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)    N)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nU$ [        R                  " U UUS9nU$ 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	Exceptionnppad)dataraw_padsr	   r
   axes
input_rankaxisnum_axesr   _iys               Y/var/www/fran/franai/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}}$STTI:q!fX	  8_w!8$D#;X(>?		  zFF+	
 
	A HA 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)	Pad4   Nc                     [         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valuer   r   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_pad5   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.   )r1   r2   r3   r   r4   r5   r6   int32r8   r9   r   r   )r	   r:   r"   r#   r   s        r   #export_reflection_edge_and_wrap_pad'Pad.export_reflection_edge_and_wrap_padC   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.   r0   r:   r"   r#   r$   r   r   s         r   export_constant_pad_axesPad.export_constant_pad_axesQ   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   rH   r   r   r%   r(   r)   r*   r+   rI   r,   rJ   test_constant_pad_negative_axesr.   r0   rM   s         r   !export_constant_pad_negative_axes%Pad.export_constant_pad_negative_axesk   s    {{$$83%j % 
 IIOOAq!Q'..rzz:xx%,,HH
 

3xxR1H
 	U)C2		
r=    )returnN)
__name__
__module____qualname____firstlineno__staticmethodr;   rE   rN   rT   __static_attributes__rV   r=   r   r   r   4   sT    U U Q Q 
 
2 
 
r=   r   )g        N)	numpyr   r1   onnx.backend.test.case.baser   onnx.backend.test.case.noder   r   r   rV   r=   r   <module>ra      s'   
   , .%PO
$ O
r=   