U
    rh                     @  sH   d dl mZ d dlZd dlZd dlmZ d dlmZ G dd deZ	dS )    )annotationsN)Base)expectc                   @  sB   e Zd ZeddddZeddddZeddddZd	S )

DeformConvNone)returnc               	   C  sP  t dt j} d| _t jdt jd}t jdt jd}d|d< d|d	< tjj	d
dddgdgddgddddgd}t 
ddddgddddgddddgddddggggt j}t|| ||g|gdd  t jd!t jd}d|d< d|d"< tjj	d
ddd#gd$gddgd%d%d%d%gd}t 
d&dgddggggt j}t|| ||g|gd'd  d S )(N	      r
      r   r
   r
      r   Zdtype)r
         r         ?r   r   r   r   皙)r      r
   r   r   XWoffset_with_paddingY_with_paddingr   r
   inputsoutputskernel_shapepadsg        g      ?g      @g       @g       @g'@g      @g      "@g      4@g      8@g      *@g      @g      .@Z#test_basic_deform_conv_with_paddingr   r   namer
   r   r   r   r   r   r   r
   offset_without_paddingY_without_paddingr   g      #@Z&test_basic_deform_conv_without_paddingnparangeastypefloat32shapeoneszerosonnxhelper	make_nodearrayr   )r   r   r   Znode_with_paddingr   r"   Znode_without_paddingr#    r0   J/tmp/pip-unpacked-wheel-xnis5xre/onnx/backend/test/case/node/deformconv.pyexport   sn    





	
zDeformConv.exportc               	   C  s   t dt j} d| _t jdt jd}t jdt jd}t jdt jd}d|d< d	|d
< t jdt jd}d|d< tjj	ddddddgdgddgddddgd}t 
ddgddggggt j}t|| ||||g|gdd d S )Nr   r	   r   r   )r
   r    r   r   r   r!   )r
   r   r   r   g?)r   r   r
   r
   r   r   r   offsetBmaskYr   r   r   g      %@g)@g      5@gffffff3@Ztest_deform_conv_with_mask_biasr   r$   )r   r   r4   r3   r5   noder6   r0   r0   r1    export_deformconv_with_mask_biasT   s>    
	
z+DeformConv.export_deformconv_with_mask_biasc               	   C  s   t jdt jd} t t dt jd| d< t t dddt jd| d< d| _t jd	t jd}t jd
t jd}d|d< d|d< tj	j
ddddgdgddgddddgdd}t ddgddggggt j}t|| ||g|gdd d S )N)r
   r   r   r   r   r   )r   r   )r   r   r   )r   r
   )r
   r   r   r   )r
      r   r   r   r   r   )r      r   r
   r   r   r   r3   r6   r   r   )r   r   r   r   Zoffset_groupg     @@g@@g      @@Z,test_deform_conv_with_multiple_offset_groupsr   )r%   r+   r(   Zreshaper&   r'   r)   r*   r,   r-   r.   r/   r   )r   r   r3   r7   r6   r0   r0   r1   -export_deformconv_with_multiple_offset_groups|   s>    "
	
z8DeformConv.export_deformconv_with_multiple_offset_groupsN)__name__
__module____qualname__staticmethodr2   r8   r<   r0   r0   r0   r1   r      s   E'r   )

__future__r   Znumpyr%   r,   Zonnx.backend.test.case.baser   Zonnx.backend.test.case.noder   r   r0   r0   r0   r1   <module>   s
   