
    Si&                    N    S SK Jr  S SKrS SKrS SKJr  S SKJr   " S S\5      r	g)    )annotationsN)Base)expectc                      \ rS rSr\SS j5       r\SS j5       r\SS j5       r\SS j5       r\SS j5       r	\SS j5       r
\SS j5       r\SS	 j5       r\SS
 j5       r\SS j5       rSrg)BitCast   c                    [         R                  R                  SS/S/[         R                  R                  S9n [
        R                  " / SQ[
        R                  S9nUR                  [
        R                  5      n[        X/U/SS9  g	)
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      b/var/www/html/ai-image-ml/venv/lib/python3.13/site-packages/onnx/backend/test/case/node/bitcast.pyexport_bitcast_float32_to_int32'BitCast.export_bitcast_float32_to_int32   s     {{$$5E%%	 % 
 HH&bjj9FF288tC!3RS    c                    [         R                  R                  SS/S/[         R                  R                  S9n [
        R                  " / SQ[
        R                  S9nUR                  [
        R                  5      n[        X/U/SS9  g	)
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_float32'BitCast.export_bitcast_int32_to_float32   ss     {{$$5E%%	 % 
 HH:"((KFF2::tC!3RSr(   c                    [         R                  R                  SS/S/[         R                  R                  S9n [
        R                  " / SQ[
        R                  S9nUR                  [
        R                  5      n[        X/U/SS9  g	)
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_int64'BitCast.export_bitcast_float64_to_int64(   r'   r(   c                    [         R                  R                  SS/S/[         R                  R                  S9n [
        R                  " / SQ[
        R                  S9nUR                  [
        R                  5      n[        X/U/SS9  g	)
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   r2   r    r1   r   r"   s      r$   export_bitcast_int64_to_float64'BitCast.export_bitcast_int64_to_float645   sx     {{$$5E&&	 % 
 HHL((
 FF2::tC!3RSr(   c                    [         R                  R                  SS/S/[         R                  R                  S9n [
        R                  " / SQ[
        R                  S9nUR                  [
        R                  5      n[        X/U/SS9  g	)
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_int32&BitCast.export_bitcast_uint32_to_int32E   ss     {{$$5E%%	 % 
 HH9KFF288tC!3QRr(   c                 "   [         R                  R                  SS/S/[         R                  R                  S9n [
        R                  " / SQ/ SQ/[
        R                  S9nUR                  [
        R                  5      n[        X/U/SS	9  g
)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_int32*BitCast.export_bitcast_2d_float32_to_int32R   sw     {{$$5E%%	 % 
 HHo7rzzJFF288tC!3UVr(   c                    [         R                  R                  SS/S/[         R                  R                  S9n [
        R                  " / SQ[
        R                  S9nUR                  [
        R                  5      n[        X/U/SS9  g	)
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_uint8$BitCast.export_bitcast_int8_to_uint8_   ss     {{$$5E%%	 % 
 HH'rww7FF288tC!3OPr(   c                    [         R                  R                  SS/S/[         R                  R                  S9n [
        R                  " S[
        R                  S9nUR                  [
        R                  5      n[        X/U/SS9  g	)
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_int32.BitCast.export_bitcast_scalar_float32_to_int32l   su     {{$$5E%%	 % 
 HHS

+FF288qc0V	
r(   c                    [         R                  R                  SS/S/[         R                  R                  S9n [
        R                  " / SQ[
        R                  S9nUR                  [
        R                  5      n[        X/U/SS9  g	)
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_int16&BitCast.export_bitcast_uint16_to_int16{   ss     {{$$5E%%	 % 
 HH&bii8FF288tC!3QRr(   c                    [         R                  R                  SS/S/[         R                  R                  S9n [
        R                  " / SQ[
        R                  S9nUR                  [
        R                  5      n[        X/U/SS9  g	)
z/Test bitcasting from bool to uint8 (same size).r   r
   r   r   )TFTFr   test_bitcast_bool_to_uint8r   N)r   r   r   r   rG   r   r   bool_r    rI   r   r"   s      r$   export_bitcast_bool_to_uint8$BitCast.export_bitcast_bool_to_uint8   ss     {{$$5E%%	 % 
 HH/rxx@FF288tC!3OPr(    N)returnNone)__name__
__module____qualname____firstlineno__staticmethodr%   r,   r3   r8   r=   rA   rJ   rN   rV   r[   __static_attributes__r]   r(   r$   r   r      s    
T 
T 
T 
T 
T 
T T T 
S 
S 
W 
W 
Q 
Q 
 
 
S 
S 
Q 
Qr(   r   )

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