o
    q::j&                     @  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                   @  s   e Zd ZedddZedddZedddZedd	d
ZedddZedddZ	edddZ
edddZedddZedddZdS )BitCastreturnNonec                  C  T   t jjddgdgt jjd} tjg dtjd}|tj	}t
| |g|gdd d	S )
z2Test bitcasting from float32 to int32 (same size).r   xyinputsoutputsto      ?g      g      @dtypetest_bitcast_float32_to_int32r   r   nameNonnxhelper	make_nodeTensorProtoINT32nparrayfloat32viewint32r   noder	   r
    r#   j/home/nk/hobo-godmode/plappi-mvp/.venv/lib/python3.10/site-packages/onnx/backend/test/case/node/bitcast.pyexport_bitcast_float32_to_int32      z'BitCast.export_bitcast_float32_to_int32c                  C  r   )
z2Test bitcasting from int32 to float32 (same size).r   r	   r
   r   )i  ?i   i  p@r   test_bitcast_int32_to_float32r   N)r   r   r   r   FLOATr   r   r    r   r   r   r!   r#   r#   r$   export_bitcast_int32_to_float32   r&   z'BitCast.export_bitcast_int32_to_float32c                  C  r   )
z2Test bitcasting from float64 to int64 (same size).r   r	   r
   r   r   r   test_bitcast_float64_to_int64r   N)r   r   r   r   INT64r   r   float64r   int64r   r!   r#   r#   r$   export_bitcast_float64_to_int64(   r&   z'BitCast.export_bitcast_float64_to_int64c                  C  r   )
z2Test bitcasting from int64 to float64 (same size).r   r	   r
   r   )l          l         l   *(I  r   test_bitcast_int64_to_float64r   N)r   r   r   r   DOUBLEr   r   r-   r   r,   r   r!   r#   r#   r$   export_bitcast_int64_to_float645   s   z'BitCast.export_bitcast_int64_to_float64c                  C  r   )
zGTest bitcasting from uint32 to int32 (same size, different signedness).r   r	   r
   r   )l    l        ir   test_bitcast_uint32_to_int32r   N)r   r   r   r   r   r   r   uint32r   r    r   r!   r#   r#   r$   export_bitcast_uint32_to_int32E   r&   z&BitCast.export_bitcast_uint32_to_int32c                  C  s\   t jjddgdgt jjd} tjg dg dgtjd}|tj	}t
| |g|gdd	 d
S )z/Test bitcasting 2D array from float32 to int32.r   r	   r
   r   )r   g       @g      @)g      @g      @g      @r    test_bitcast_2d_float32_to_int32r   Nr   r!   r#   r#   r$   "export_bitcast_2d_float32_to_int32R   s   z*BitCast.export_bitcast_2d_float32_to_int32c                  C  r   )
zETest bitcasting from int8 to uint8 (same size, different signedness).r   r	   r
   r   )i   r   r   test_bitcast_int8_to_uint8r   N)r   r   r   r   UINT8r   r   int8r   uint8r   r!   r#   r#   r$   export_bitcast_int8_to_uint8_   r&   z$BitCast.export_bitcast_int8_to_uint8c                  C  sP   t jjddgdgt jjd} tjdtjd}|tj	}t
| |g|gdd d	S )
z-Test bitcasting scalar from float32 to int32.r   r	   r
   r   r   r   $test_bitcast_scalar_float32_to_int32r   Nr   r!   r#   r#   r$   &export_bitcast_scalar_float32_to_int32l   s   
z.BitCast.export_bitcast_scalar_float32_to_int32c                  C  r   )
zGTest bitcasting from uint16 to int16 (same size, different signedness).r   r	   r
   r   )   i   i  r   test_bitcast_uint16_to_int16r   N)r   r   r   r   INT16r   r   uint16r   int16r   r!   r#   r#   r$   export_bitcast_uint16_to_int16{   r&   z&BitCast.export_bitcast_uint16_to_int16c                  C  r   )
z/Test bitcasting from bool to uint8 (same size).r   r	   r
   r   )TFTFr   test_bitcast_bool_to_uint8r   N)r   r   r   r   r:   r   r   bool_r   r<   r   r!   r#   r#   r$   export_bitcast_bool_to_uint8   r&   z$BitCast.export_bitcast_bool_to_uint8N)r   r   )__name__
__module____qualname__staticmethodr%   r)   r.   r1   r4   r6   r=   r?   rE   rH   r#   r#   r#   r$   r      s*    r   )

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