
    wi                        d dl mZ d dlZd dlmZ ddZ G d de          Z G d d	e          Z G d
 de          Z	 G d de          Z
dS )    )annotationsN)OpRun        c                   | j         |t          t                              }nfd|D             }t          |          }|dz  t          |          k    rt	          d          dgz  }t          |          D ]\  }}||         }	|||z            }
|	|
f||<    |dk    r0t          j        | |||                              | j	                  S t          j        | ||                              | j	                  S )Nc                *    g | ]}|d k    r|n|z   S )r    ).0axis
input_ranks     i/root/.openclaw/workspace/chatterbox_venv_py311/lib/python3.11/site-packages/onnx/reference/ops/op_pad.py
<listcomp>z_pad_impl.<locals>.<listcomp>   s*    JJJT		tj'8JJJ       zGThe number of elements in raw_pads should be 2 times the number of axes)r   r   constant)	pad_widthmodeconstant_values)r   r   )
ndimlistrangelenRuntimeError	enumeratenppadastypedtype)dataraw_padsr   r   axesnum_axesr   ir
   	pad_beginpad_endr   s              @r   	_pad_implr%      s'   J|E*%%&&JJJJTJJJ4yyH!|s8}}$$U
 
 	
 :%IT?? / /4QK	8a<($g.	$zvID/
 
 

&

	 6$)$777>>tzJJJr   c                      e Zd ZddZdS )Pad_1Nc                2    |d}t          ||||          fS Nr   )r   r   r%   )selfr   paddingsr   values        r   _runz
Pad_1._run%   s&    =E$tUKKKMMr   NNN__name__
__module____qualname__r.   r   r   r   r'   r'   $   s.        N N N N N Nr   r'   c                      e Zd ZddZdS )Pad_2Nc                2    |d}t          ||||          fS r)   r*   )r+   r   padsr   r-   s        r   r.   z
Pad_2._run,   s&    =E$4GGGIIr   r/   r0   r   r   r   r5   r5   +   s.        J J J J J Jr   r5   c                      e Zd ZddZdS )Pad_11Nc                4    |d}t          ||||d           fS Nr   )r   r   r    r*   )r+   r   r7   constant_valuer   s        r   r.   zPad_11._run3   .    !NdDt^RVWWW
 	
r   )NNr0   r   r   r   r9   r9   2   (        
 
 
 
 
 
r   r9   c                      e Zd ZddZdS )Pad_18Nc                4    |d}t          |||||          fS r;   r*   )r+   r   r7   r<   r    r   s         r   r.   zPad_18._run<   r=   r   r/   r0   r   r   r   r@   r@   ;   r>   r   r@   )r   N)
__future__r   numpyr   onnx.reference.op_runr   r%   r'   r5   r9   r@   r   r   r   <module>rE      s   # " " " " "     ' ' ' ' ' 'K K K K2N N N N NE N N NJ J J J JE J J J
 
 
 
 
U 
 
 

 
 
 
 
U 
 
 
 
 
r   