o
    soi                     @  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                   @  s6   e Zd Zed
ddZed
ddZed
ddZd	S )
DeformConvreturnNonec                  C  s4  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
g ddgddgg dd}t 
g dg dg dg dgggt j}t|| ||g|gdd t jdt jd}d|d< d|d< tjj	d
g ddgddg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   dtype)r
         r         ?r   r   r   r   皙)r      r
   r   r   )XWoffset_with_paddingY_with_paddingr   )r
   r
   r
   r
   inputsoutputskernel_shapepads)g        g      ?      @g       @)r          @'@g      @)g      "@      4@      8@      *@)g      @r$   g      .@r    #test_basic_deform_conv_with_paddingr   r   namer
   r   r   r   r   r   r   r
   )r   r   offset_without_paddingY_without_paddingg      #@r!   r"   r#   &test_basic_deform_conv_without_paddingnparangeastypefloat32shapeoneszerosonnxhelper	make_nodearrayr   )r   r   r   node_with_paddingr   r*   node_without_paddingr+    r;   Z/home/ubuntu/.local/lib/python3.10/site-packages/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g ddgddgg d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   g      %@g)@g      5@gffffff3@test_deform_conv_with_mask_biasr&   r-   )r   r   r?   r>   r@   noderA   r;   r;   r<    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g ddgddgg d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   r>   rA   r   )r   r   r   r   offset_groupg     @@g@@g      @@,test_deform_conv_with_multiple_offset_groupsr&   )r.   r4   r1   reshaper/   r0   r2   r3   r5   r6   r7   r8   r   )r   r   r>   rC   rA   r;   r;   r<   -export_deformconv_with_multiple_offset_groups|   s>   "	

z8DeformConv.export_deformconv_with_multiple_offset_groupsN)r   r   )__name__
__module____qualname__staticmethodr=   rD   rK   r;   r;   r;   r<   r      s    E'r   )

__future__r   numpyr.   r5   onnx.backend.test.case.baser   onnx.backend.test.case.noder   r   r;   r;   r;   r<   <module>   s   