
    /j&                    V    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e          Z	dS )    )annotationsN)Base)expectc                      e Zd Zedd            Zedd            Zedd            Zedd            Zedd            Zedd            Z	edd	            Z
edd
            Zedd            Zedd            ZdS )BitCastreturnNonec                    t           j                            ddgdgt           j        j                  } t          j        g dt
          j                  }|                    t
          j	                  }t          | |g|g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   s      h/home/longshao/multi-rider-rag/.venv/lib/python3.11/site-packages/onnx/backend/test/case/node/bitcast.pyexport_bitcast_float32_to_int32z'BitCast.export_bitcast_float32_to_int32        {$$5E%	 % 
 
 H&&&bj999FF28tQC!3RSSSSSS    c                    t           j                            ddgdgt           j        j                  } t          j        g dt
          j                  }|                    t
          j	                  }t          | |g|gd           d	S )
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#   s      r%   export_bitcast_int32_to_float32z'BitCast.export_bitcast_int32_to_float32   s     {$$5E%	 % 
 
 H:::"(KKKFF2:tQC!3RSSSSSSr(   c                    t           j                            ddgdgt           j        j                  } t          j        g dt
          j                  }|                    t
          j	                  }t          | |g|gd           d	S )
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#   s      r%   export_bitcast_float64_to_int64z'BitCast.export_bitcast_float64_to_int64(   r'   r(   c                    t           j                            ddgdgt           j        j                  } t          j        g dt
          j                  }|                    t
          j	                  }t          | |g|gd           d	S )
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   r1   r!   r0   r   r#   s      r%   export_bitcast_int64_to_float64z'BitCast.export_bitcast_int64_to_float645   s     {$$5E&	 % 
 
 HLLL(
 
 
 FF2:tQC!3RSSSSSSr(   c                    t           j                            ddgdgt           j        j                  } t          j        g dt
          j                  }|                    t
          j	                  }t          | |g|gd           d	S )
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#   s      r%   export_bitcast_uint32_to_int32z&BitCast.export_bitcast_uint32_to_int32E   s     {$$5E%	 % 
 
 H999KKKFF28tQC!3QRRRRRRr(   c                 "   t           j                            ddgdgt           j        j                  } t          j        g dg dgt
          j                  }|                    t
          j	                  }t          | |g|g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#   s      r%   "export_bitcast_2d_float32_to_int32z*BitCast.export_bitcast_2d_float32_to_int32R   s     {$$5E%	 % 
 
 Hooo7rzJJJFF28tQC!3UVVVVVVr(   c                    t           j                            ddgdgt           j        j                  } t          j        g dt
          j                  }|                    t
          j	                  }t          | |g|gd           d	S )
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#   s      r%   export_bitcast_int8_to_uint8z$BitCast.export_bitcast_int8_to_uint8_   s     {$$5E%	 % 
 
 H'''rw777FF28tQC!3OPPPPPPr(   c                    t           j                            ddgdgt           j        j                  } t          j        dt
          j                  }|                    t
          j	                  }t          | |g|g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#   s      r%   &export_bitcast_scalar_float32_to_int32z.BitCast.export_bitcast_scalar_float32_to_int32l   s     {$$5E%	 % 
 
 HS
+++FF28!qc0V	
 	
 	
 	
 	
 	
r(   c                    t           j                            ddgdgt           j        j                  } t          j        g dt
          j                  }|                    t
          j	                  }t          | |g|gd           d	S )
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#   s      r%   export_bitcast_uint16_to_int16z&BitCast.export_bitcast_uint16_to_int16{   s     {$$5E%	 % 
 
 H&&&bi888FF28tQC!3QRRRRRRr(   c                    t           j                            ddgdgt           j        j                  } t          j        g dt
          j                  }|                    t
          j	                  }t          | |g|gd           d	S )
z/Test bitcasting from bool to uint8 (same size).r   r   r   r   )TFTFr   test_bitcast_bool_to_uint8r   N)r   r   r   r   rB   r   r   bool_r!   rD   r   r#   s      r%   export_bitcast_bool_to_uint8z$BitCast.export_bitcast_bool_to_uint8   s     {$$5E%	 % 
 
 H///rx@@@FF28tQC!3OPPPPPPr(   N)r   r	   )__name__
__module____qualname__staticmethodr&   r,   r2   r6   r:   r=   rE   rH   rO   rS    r(   r%   r   r      sx       
T 
T 
T \
T 
T 
T 
T \
T 
T 
T 
T \
T T T T \T 
S 
S 
S \
S 
W 
W 
W \
W 
Q 
Q 
Q \
Q 
 
 
 \
 
S 
S 
S \
S 
Q 
Q 
Q \
Q 
Q 
Qr(   r   )

__future__r   numpyr   r   onnx.backend.test.case.baser   onnx.backend.test.case.noder   r   rX   r(   r%   <module>r]      s    # " " " " "      , , , , , , . . . . . .FQ FQ FQ FQ FQd FQ FQ FQ FQ FQr(   