-
-
Save justinchuby/bc5b40213b0e2319eeb717b524726664 to your computer and use it in GitHub Desktop.
"""Verify the cast values""" | |
import os | |
import onnx | |
import onnx_ir as ir | |
DIR = "onnx/backend/test/data/node/" | |
def verify_one_case(path: str): | |
test_name = os.path.basename(path) | |
input_path = os.path.join(path, "test_data_set_0", "input_0.pb") | |
output_path = os.path.join(path, "test_data_set_0", "output_0.pb") | |
input_tensor = ir.from_proto(onnx.load_tensor(input_path)) | |
output_tensor = ir.from_proto(onnx.load_tensor(output_path)) | |
print("Test", test_name) | |
print(" Input:", input_tensor) | |
print(" Input Numpy:", input_tensor.numpy()) | |
print() | |
print(" Input Bytes:", input_tensor.tobytes().hex(" ")) | |
print() | |
print(" Output:", output_tensor) | |
print(" Output Numpy:", output_tensor.numpy()) | |
print() | |
print(" Output Bytes:", output_tensor.tobytes().hex(" ")) | |
print() | |
print("--------------------") | |
def main(): | |
for file in sorted(os.listdir(DIR)): | |
if file.startswith("test_cast_") and "STRING" not in file: | |
path = os.path.join(DIR, file) | |
verify_one_case(path) | |
if __name__ == "__main__": | |
main() |
Test test_cast_BFLOAT16_to_FLOAT
Input: TensorProtoTensor<BFLOAT16,[3,4]>(name='x')
Input Numpy: [[0.478516 0.480469 0.5 0.820312]
[0.470703 0.816406 0.210938 0.722656]
[nan inf inf -inf]]
Input Bytes: f5 3e f6 3e 00 3f 52 3f f1 3e 51 3f 58 3e 39 3f c0 7f 80 7f 80 7f 80 ff
Output: TensorProtoTensor<FLOAT,[3,4]>(name='x')
Output Numpy: [[0.47851562 0.48046875 0.5 0.8203125 ]
[0.47070312 0.81640625 0.2109375 0.72265625]
[ nan inf inf -inf]]
Output Bytes: 00 00 f5 3e 00 00 f6 3e 00 00 00 3f 00 00 52 3f 00 00 f1 3e 00 00 51 3f 00 00 58 3e 00 00 39 3f 00 00 c0 7f 00 0
0 80 7f 00 00 80 7f 00 00 80 ff
Test test_cast_DOUBLE_to_FLOAT
Input: TensorProtoTensor<DOUBLE,[3,4]>(name='x')
Input Numpy: [[0.47892547 0.48033667 0.49968487 0.81910545]
[0.47031248 0.816468 0.21087195 0.72290379]
[ nan inf inf -inf]]
Input Bytes: 00 00 00 00 b7 a6 de 3f 00 00 00 00 d6 bd de 3f 00 00 00 40 d6 fa df 3f 00 00 00 a0 1c 36 ea 3f 00 00 00 80 99 19
de 3f 00 00 00 80 81 20 ea 3f 00 00 00 20 da fd ca 3f 00 00 00 20 07 22 e7 3f 00 00 00 00 00 00 f8 7f 00 00 00 00 00 00 f0 7f 00 00 00 00 00 00 f0 7f 00 00 00 00 00 00 f0 ff
Output: TensorProtoTensor<FLOAT,[3,4]>(name='x')
Output Numpy: [[0.47892547 0.48033667 0.49968487 0.81910545]
[0.47031248 0.816468 0.21087195 0.7229038 ]
[ nan inf inf -inf]]
Output Bytes: b8 35 f5 3e b0 ee f5 3e b2 d6 ff 3e e5 b0 51 3f cc cc f0 3e 0c 04 51 3f d1 ee 57 3e 39 10 39 3f 00 00 c0 7f 00 0
0 80 7f 00 00 80 7f 00 00 80 ff
Test test_cast_DOUBLE_to_FLOAT16
Input: TensorProtoTensor<DOUBLE,[3,4]>(name='x')
Input Numpy: [[0.47892547 0.48033667 0.49968487 0.81910545]
[0.47031248 0.816468 0.21087195 0.72290379]
[ nan inf inf -inf]]
Input Bytes: 00 00 00 00 b7 a6 de 3f 00 00 00 00 d6 bd de 3f 00 00 00 40 d6 fa df 3f 00 00 00 a0 1c 36 ea 3f 00 00 00 80 99 19
de 3f 00 00 00 80 81 20 ea 3f 00 00 00 20 da fd ca 3f 00 00 00 20 07 22 e7 3f 00 00 00 00 00 00 f8 7f 00 00 00 00 00 00 f0 7f 00 00 00 00 00 00 f0 7f 00 00 00 00 00 00 f0 ff
Output: TensorProtoTensor<FLOAT16,[3,4]>(name='x')
Output Numpy: [[0.479 0.4802 0.4998 0.8193]
[0.4702 0.8164 0.2108 0.723 ]
[ nan inf inf -inf]]
Output Bytes: aa 37 af 37 ff 37 8e 3a 86 37 88 3a bf 32 c9 39 00 7e 00 7c 00 7c 00 fc
Test test_cast_FLOAT16_to_DOUBLE
Input: TensorProtoTensor<FLOAT16,[3,4]>(name='x')
Input Numpy: [[0.479 0.4802 0.4998 0.8193]
[0.4702 0.8164 0.2108 0.723 ]
[ nan inf inf -inf]]
Input Bytes: aa 37 af 37 ff 37 8e 3a 86 37 88 3a bf 32 c9 39 00 7e 00 7c 00 7c 00 fc
Output: TensorProtoTensor<DOUBLE,[3,4]>(name='x')
Output Numpy: [[0.47900391 0.48022461 0.49975586 0.81933594]
[0.47021484 0.81640625 0.21081543 0.72314453]
[ nan inf inf -inf]]
Output Bytes: 00 00 00 00 00 a8 de 3f 00 00 00 00 00 bc de 3f 00 00 00 00 00 fc df 3f 00 00 00 00 00 38 ea 3f 00 00 00 00 00 1
8 de 3f 00 00 00 00 00 20 ea 3f 00 00 00 00 00 fc ca 3f 00 00 00 00 00 24 e7 3f 00 00 00 00 00 00 f8 7f 00 00 00 00 00 00 f0 7f 00 00 00 00 00 00 f0 7f 00 00 00 00 00 00 f0 ff
Test test_cast_FLOAT16_to_FLOAT
Input: TensorProtoTensor<FLOAT16,[3,4]>(name='x')
Input Numpy: [[0.479 0.4802 0.4998 0.8193]
[0.4702 0.8164 0.2108 0.723 ]
[ nan inf inf -inf]]
Input Bytes: aa 37 af 37 ff 37 8e 3a 86 37 88 3a bf 32 c9 39 00 7e 00 7c 00 7c 00 fc
Output: TensorProtoTensor<FLOAT,[3,4]>(name='x')
Output Numpy: [[0.4790039 0.4802246 0.49975586 0.81933594]
[0.47021484 0.81640625 0.21081543 0.72314453]
[ nan inf inf -inf]]
Output Bytes: 00 40 f5 3e 00 e0 f5 3e 00 e0 ff 3e 00 c0 51 3f 00 c0 f0 3e 00 00 51 3f 00 e0 57 3e 00 20 39 3f 00 00 c0 7f 00 0
0 80 7f 00 00 80 7f 00 00 80 ff
Test test_cast_FLOAT16_to_FLOAT4E2M1
Input: TensorProtoTensor<FLOAT16,[3,5]>(name='x')
Input Numpy: [[ 4.80e-01 2.50e-01 1.05e+00 -3.50e+00 -8.00e+00]
[ 9.00e+00 inf 1.19e-07 nan inf]
[ inf -inf -4.00e+00 1.00e-02 -0.00e+00]]
Input Bytes: ae 37 00 34 33 3c 00 c3 00 c8 80 48 00 7c 02 00 00 7e 00 7c 00 7c 00 fc 00 c4 1f 21 00 80
Output: TensorProtoTensor<FLOAT4E2M1,[3,5]>(name='x')
Output Numpy: [[0 0 -6 -6 -1]
[-6 4 0 0 0]
[-1 -6 -2 -6 0]]
Output Bytes: 01 e2 7f 07 78 f7 0e 08
Test test_cast_FLOAT16_to_FLOAT8E4M3FN
Input: TensorProtoTensor<FLOAT16,[3,5]>(name='x')
Input Numpy: [[ 4.790e-01 4.802e-01 4.998e-01 8.193e-01 4.702e-01]
[ 7.231e-01 inf 1.192e-07 nan inf]
[ inf -inf -1.192e-07 1.192e-07 -inf]]
Input Bytes: aa 37 af 37 ff 37 8e 3a 86 37 c9 39 00 7c 02 00 00 7e 00 7c 00 7c 00 fc 02 80 02 00 00 fc
Output: TensorProtoTensor<FLOAT8E4M3FN,[3,5]>(name='x')
Output Numpy: [[0.46875 0.46875 0.5 0.8125 0.46875]
[0.75 448 0 nan 448]
[448 -448 -0 0 -448]]
Output Bytes: 2f 2f 30 35 2f 34 7e 00 7f 7e 7e fe 80 00 fe
Test test_cast_FLOAT16_to_FLOAT8E4M3FNUZ
Input: TensorProtoTensor<FLOAT16,[3,5]>(name='x')
Input Numpy: [[ 4.790e-01 4.802e-01 4.998e-01 8.193e-01 4.702e-01]
[ 7.231e-01 inf 1.192e-07 nan inf]
[ inf -inf -1.192e-07 1.192e-07 -inf]]
Input Bytes: aa 37 af 37 ff 37 8e 3a 86 37 c9 39 00 7c 02 00 00 7e 00 7c 00 7c 00 fc 02 80 02 00 00 fc
Output: TensorProtoTensor<FLOAT8E4M3FNUZ,[3,5]>(name='x')
Output Numpy: [[0.46875 0.46875 0.5 0.8125 0.46875]
[0.75 240 0 nan 240]
[240 -240 0 0 -240]]
Output Bytes: 37 37 38 3d 37 3c 7f 00 80 7f 7f ff 00 00 ff
Test test_cast_FLOAT16_to_FLOAT8E5M2
Input: TensorProtoTensor<FLOAT16,[3,5]>(name='x')
Input Numpy: [[ 4.790e-01 4.802e-01 4.998e-01 8.193e-01 4.702e-01]
[ 7.231e-01 inf 1.192e-07 nan inf]
[ inf -inf -1.192e-07 1.192e-07 -inf]]
Input Bytes: aa 37 af 37 ff 37 8e 3a 86 37 c9 39 00 7c 02 00 00 7e 00 7c 00 7c 00 fc 02 80 02 00 00 fc
Output: TensorProtoTensor<FLOAT8E5M2,[3,5]>(name='x')
Output Numpy: [[0.5 0.5 0.5 0.875 0.5]
[0.75 57344 0 nan 57344]
[57344 -57344 -0 0 -57344]]
Output Bytes: 38 38 38 3b 38 3a 7b 00 7e 7b 7b fb 80 00 fb
Test test_cast_FLOAT16_to_FLOAT8E5M2FNUZ
Input: TensorProtoTensor<FLOAT16,[3,5]>(name='x')
Input Numpy: [[ 4.790e-01 4.802e-01 4.998e-01 8.193e-01 4.702e-01]
[ 7.231e-01 inf 1.192e-07 nan inf]
[ inf -inf -1.192e-07 1.192e-07 -inf]]
Input Bytes: aa 37 af 37 ff 37 8e 3a 86 37 c9 39 00 7c 02 00 00 7e 00 7c 00 7c 00 fc 02 80 02 00 00 fc
Output: TensorProtoTensor<FLOAT8E5M2FNUZ,[3,5]>(name='x')
Output Numpy: [[0.5 0.5 0.5 0.875 0.5]
[0.75 57344 0 nan 57344]
[57344 -57344 0 0 -57344]]
Output Bytes: 3c 3c 3c 3f 3c 3e 7f 00 80 7f 7f ff 00 00 ff
Test test_cast_FLOAT16_to_INT4
Input: TensorProtoTensor<FLOAT16,[5,5]>(name='x')
Input Numpy: [[-9. -8. -7. -6. -5.]
[-4. -3. -2. -1. 0.]
[ 1. 2. 3. 4. 5.]
[ 6. 7. 8. 9. 10.]
[11. 12. 13. 14. 15.]]
Input Bytes: 80 c8 00 c8 00 c7 00 c6 00 c5 00 c4 00 c2 00 c0 00 bc 00 00 00 3c 00 40 00 42 00 44 00 45 00 46 00 47 00 48 80 48
00 49 80 49 00 4a 80 4a 00 4b 80 4b
Output: TensorProtoTensor<INT4,[5,5]>(name='x')
Output Numpy: [[7 0 -7 -1 -5]
[-1 -3 -1 -1 -1]
[1 0 3 0 5]
[0 7 0 -7 -1]
[-5 -1 -3 -1 -1]]
Output Bytes: 87 a9 cb ed 0f 21 43 65 87 a9 cb ed 0f
Test test_cast_FLOAT16_to_UINT4
Input: TensorProtoTensor<FLOAT16,[5,5]>(name='x')
Input Numpy: [[-9. -8. -7. -6. -5.]
[-4. -3. -2. -1. 0.]
[ 1. 2. 3. 4. 5.]
[ 6. 7. 8. 9. 10.]
[11. 12. 13. 14. 15.]]
Input Bytes: 80 c8 00 c8 00 c7 00 c6 00 c5 00 c4 00 c2 00 c0 00 bc 00 00 00 3c 00 40 00 42 00 44 00 45 00 46 00 47 00 48 80 48
00 49 80 49 00 4a 80 4a 00 4b 80 4b
Output: TensorProtoTensor<UINT4,[5,5]>(name='x')
Output Numpy: [[7 0 9 0 11]
[0 13 0 15 0]
[1 0 3 0 5]
[0 7 0 9 0]
[11 0 13 0 15]]
Output Bytes: 87 a9 cb ed 0f 21 43 65 87 a9 cb ed 0f
Test test_cast_FLOAT4E2M1_to_FLOAT
Input: TensorProtoTensor<FLOAT4E2M1,[3,5]>(name='x')
Input Numpy: [[0 0 -6 -6 -1]
[-6 4 0 0 0]
[-1 -6 -2 -6 0]]
Input Bytes: 01 e2 7f 07 78 f7 0e 08
Output: TensorProtoTensor<FLOAT,[3,5]>(name='x')
Output Numpy: [[ 0.5 0. 1. -4. -6. ]
[ 6. 6. 0. -0. 6. ]
[ 6. -6. -4. 0. -0. ]]
Output Bytes: 00 00 00 3f 00 00 00 00 00 00 80 3f 00 00 80 c0 00 00 c0 c0 00 00 c0 40 00 00 c0 40 00 00 00 00 00 00 00 80 00 0
0 c0 40 00 00 c0 40 00 00 c0 c0 00 00 80 c0 00 00 00 00 00 00 00 80
Test test_cast_FLOAT4E2M1_to_FLOAT16
Input: TensorProtoTensor<FLOAT4E2M1,[3,5]>(name='x')
Input Numpy: [[0 0 -6 -6 -1]
[-6 4 0 0 0]
[-1 -6 -2 -6 0]]
Input Bytes: 01 e2 7f 07 78 f7 0e 08
Output: TensorProtoTensor<FLOAT16,[3,5]>(name='x')
Output Numpy: [[ 0.5 0. 1. -4. -6. ]
[ 6. 6. 0. -0. 6. ]
[ 6. -6. -4. 0. -0. ]]
Output Bytes: 00 38 00 00 00 3c 00 c4 00 c6 00 46 00 46 00 00 00 80 00 46 00 46 00 c6 00 c4 00 00 00 80
Test test_cast_FLOAT8E4M3FNUZ_to_FLOAT
Input: TensorProtoTensor<FLOAT8E4M3FNUZ,[3,5]>(name='x')
Input Numpy: [[0.46875 0.46875 0.5 0.8125 0.46875]
[0.75 240 0 nan 240]
[240 -240 0 0 -240]]
Input Bytes: 37 37 38 3d 37 3c 7f 00 80 7f 7f ff 00 00 ff
Output: TensorProtoTensor<FLOAT,[3,5]>(name='x')
Output Numpy: [[ 0.46875 0.46875 0.5 0.8125 0.46875]
[ 0.75 240. 0. nan 240. ]
[ 240. -240. 0. 0. -240. ]]
Output Bytes: 00 00 f0 3e 00 00 f0 3e 00 00 00 3f 00 00 50 3f 00 00 f0 3e 00 00 40 3f 00 00 70 43 00 00 00 00 00 00 c0 ff 00 0
0 70 43 00 00 70 43 00 00 70 c3 00 00 00 00 00 00 00 00 00 00 70 c3
Test test_cast_FLOAT8E4M3FNUZ_to_FLOAT16
Input: TensorProtoTensor<FLOAT8E4M3FNUZ,[3,5]>(name='x')
Input Numpy: [[0.46875 0.46875 0.5 0.8125 0.46875]
[0.75 240 0 nan 240]
[240 -240 0 0 -240]]
Input Bytes: 37 37 38 3d 37 3c 7f 00 80 7f 7f ff 00 00 ff
Output: TensorProtoTensor<FLOAT16,[3,5]>(name='x')
Output Numpy: [[ 0.4688 0.4688 0.5 0.8125 0.4688]
[ 0.75 240. 0. nan 240. ]
[ 240. -240. 0. 0. -240. ]]
Output Bytes: 80 37 80 37 00 38 80 3a 80 37 00 3a 80 5b 00 00 00 fe 80 5b 80 5b 80 db 00 00 00 00 80 db
Test test_cast_FLOAT8E4M3FN_to_FLOAT
Input: TensorProtoTensor<FLOAT8E4M3FN,[3,5]>(name='x')
Input Numpy: [[0.46875 0.46875 0.5 0.8125 0.46875]
[0.75 448 0 nan 448]
[448 -448 -0 0 -448]]
Input Bytes: 2f 2f 30 35 2f 34 7e 00 7f 7e 7e fe 80 00 fe
Output: TensorProtoTensor<FLOAT,[3,5]>(name='x')
Output Numpy: [[ 0.46875 0.46875 0.5 0.8125 0.46875]
[ 0.75 448. 0. nan 448. ]
[ 448. -448. -0. 0. -448. ]]
Output Bytes: 00 00 f0 3e 00 00 f0 3e 00 00 00 3f 00 00 50 3f 00 00 f0 3e 00 00 40 3f 00 00 e0 43 00 00 00 00 00 00 c0 7f 00 0
0 e0 43 00 00 e0 43 00 00 e0 c3 00 00 00 80 00 00 00 00 00 00 e0 c3
Test test_cast_FLOAT8E4M3FN_to_FLOAT16
Input: TensorProtoTensor<FLOAT8E4M3FN,[3,5]>(name='x')
Input Numpy: [[0.46875 0.46875 0.5 0.8125 0.46875]
[0.75 448 0 nan 448]
[448 -448 -0 0 -448]]
Input Bytes: 2f 2f 30 35 2f 34 7e 00 7f 7e 7e fe 80 00 fe
Output: TensorProtoTensor<FLOAT16,[3,5]>(name='x')
Output Numpy: [[ 0.4688 0.4688 0.5 0.8125 0.4688]
[ 0.75 448. 0. nan 448. ]
[ 448. -448. -0. 0. -448. ]]
Output Bytes: 80 37 80 37 00 38 80 3a 80 37 00 3a 00 5f 00 00 00 7e 00 5f 00 5f 00 df 00 80 00 00 00 df
Test test_cast_FLOAT8E5M2FNUZ_to_FLOAT
Input: TensorProtoTensor<FLOAT8E5M2FNUZ,[3,5]>(name='x')
Input Numpy: [[0.5 0.5 0.5 0.875 0.5]
[0.75 57344 0 nan 57344]
[57344 -57344 0 0 -57344]]
Input Bytes: 3c 3c 3c 3f 3c 3e 7f 00 80 7f 7f ff 00 00 ff
Output: TensorProtoTensor<FLOAT,[3,5]>(name='x')
Output Numpy: [[ 5.0000e-01 5.0000e-01 5.0000e-01 8.7500e-01 5.0000e-01]
[ 7.5000e-01 5.7344e+04 0.0000e+00 nan 5.7344e+04]
[ 5.7344e+04 -5.7344e+04 0.0000e+00 0.0000e+00 -5.7344e+04]]
Output Bytes: 00 00 00 3f 00 00 00 3f 00 00 00 3f 00 00 60 3f 00 00 00 3f 00 00 40 3f 00 00 60 47 00 00 00 00 00 00 c0 ff 00 0
0 60 47 00 00 60 47 00 00 60 c7 00 00 00 00 00 00 00 00 00 00 60 c7
Test test_cast_FLOAT8E5M2FNUZ_to_FLOAT16
Input: TensorProtoTensor<FLOAT8E5M2FNUZ,[3,5]>(name='x')
Input Numpy: [[0.5 0.5 0.5 0.875 0.5]
[0.75 57344 0 nan 57344]
[57344 -57344 0 0 -57344]]
Input Bytes: 3c 3c 3c 3f 3c 3e 7f 00 80 7f 7f ff 00 00 ff
Output: TensorProtoTensor<FLOAT16,[3,5]>(name='x')
Output Numpy: [[ 5.000e-01 5.000e-01 5.000e-01 8.750e-01 5.000e-01]
[ 7.500e-01 5.734e+04 0.000e+00 nan 5.734e+04]
[ 5.734e+04 -5.734e+04 0.000e+00 0.000e+00 -5.734e+04]]
Output Bytes: 00 38 00 38 00 38 00 3b 00 38 00 3a 00 7b 00 00 00 fe 00 7b 00 7b 00 fb 00 00 00 00 00 fb
Test test_cast_FLOAT8E5M2_to_FLOAT
Input: TensorProtoTensor<FLOAT8E5M2,[3,5]>(name='x')
Input Numpy: [[0.5 0.5 0.5 0.875 0.5]
[0.75 57344 0 nan 57344]
[57344 -57344 -0 0 -57344]]
Input Bytes: 38 38 38 3b 38 3a 7b 00 7e 7b 7b fb 80 00 fb
Output: TensorProtoTensor<FLOAT,[3,5]>(name='x')
Output Numpy: [[ 5.0000e-01 5.0000e-01 5.0000e-01 8.7500e-01 5.0000e-01]
[ 7.5000e-01 5.7344e+04 0.0000e+00 nan 5.7344e+04]
[ 5.7344e+04 -5.7344e+04 -0.0000e+00 0.0000e+00 -5.7344e+04]]
Output Bytes: 00 00 00 3f 00 00 00 3f 00 00 00 3f 00 00 60 3f 00 00 00 3f 00 00 40 3f 00 00 60 47 00 00 00 00 00 00 c0 7f 00 0
0 60 47 00 00 60 47 00 00 60 c7 00 00 00 80 00 00 00 00 00 00 60 c7
Test test_cast_FLOAT8E5M2_to_FLOAT16
Input: TensorProtoTensor<FLOAT8E5M2,[3,5]>(name='x')
Input Numpy: [[0.5 0.5 0.5 0.875 0.5]
[0.75 57344 0 nan 57344]
[57344 -57344 -0 0 -57344]]
Input Bytes: 38 38 38 3b 38 3a 7b 00 7e 7b 7b fb 80 00 fb
Output: TensorProtoTensor<FLOAT16,[3,5]>(name='x')
Output Numpy: [[ 5.000e-01 5.000e-01 5.000e-01 8.750e-01 5.000e-01]
[ 7.500e-01 5.734e+04 0.000e+00 nan 5.734e+04]
[ 5.734e+04 -5.734e+04 -0.000e+00 0.000e+00 -5.734e+04]]
Output Bytes: 00 38 00 38 00 38 00 3b 00 38 00 3a 00 7b 00 00 00 7e 00 7b 00 7b 00 fb 00 80 00 00 00 fb
Test test_cast_FLOAT_to_BFLOAT16
Input: TensorProtoTensor<FLOAT,[3,4]>(name='x')
Input Numpy: [[0.47892547 0.48033667 0.49968487 0.81910545]
[0.47031248 0.816468 0.21087195 0.7229038 ]
[ nan inf inf -inf]]
Input Bytes: b8 35 f5 3e b0 ee f5 3e b2 d6 ff 3e e5 b0 51 3f cc cc f0 3e 0c 04 51 3f d1 ee 57 3e 39 10 39 3f 00 00 c0 7f 00 00
80 7f 00 00 80 7f 00 00 80 ff
Output: TensorProtoTensor<BFLOAT16,[3,4]>(name='x')
Output Numpy: [[0.478516 0.480469 0.5 0.820312]
[0.470703 0.816406 0.210938 0.722656]
[nan inf inf -inf]]
Output Bytes: f5 3e f6 3e 00 3f 52 3f f1 3e 51 3f 58 3e 39 3f c0 7f 80 7f 80 7f 80 ff
Test test_cast_FLOAT_to_DOUBLE
Input: TensorProtoTensor<FLOAT,[3,4]>(name='x')
Input Numpy: [[0.47892547 0.48033667 0.49968487 0.81910545]
[0.47031248 0.816468 0.21087195 0.7229038 ]
[ nan inf inf -inf]]
Input Bytes: b8 35 f5 3e b0 ee f5 3e b2 d6 ff 3e e5 b0 51 3f cc cc f0 3e 0c 04 51 3f d1 ee 57 3e 39 10 39 3f 00 00 c0 7f 00 00
80 7f 00 00 80 7f 00 00 80 ff
Output: TensorProtoTensor<DOUBLE,[3,4]>(name='x')
Output Numpy: [[0.47892547 0.48033667 0.49968487 0.81910545]
[0.47031248 0.816468 0.21087195 0.72290379]
[ nan inf inf -inf]]
Output Bytes: 00 00 00 00 b7 a6 de 3f 00 00 00 00 d6 bd de 3f 00 00 00 40 d6 fa df 3f 00 00 00 a0 1c 36 ea 3f 00 00 00 80 99 1
9 de 3f 00 00 00 80 81 20 ea 3f 00 00 00 20 da fd ca 3f 00 00 00 20 07 22 e7 3f 00 00 00 00 00 00 f8 7f 00 00 00 00 00 00 f0 7f 00 00 00 00 00 00 f0 7f 00 00 00 00 00 00 f0 ff
Test test_cast_FLOAT_to_FLOAT16
Input: TensorProtoTensor<FLOAT,[3,4]>(name='x')
Input Numpy: [[0.47892547 0.48033667 0.49968487 0.81910545]
[0.47031248 0.816468 0.21087195 0.7229038 ]
[ nan inf inf -inf]]
Input Bytes: b8 35 f5 3e b0 ee f5 3e b2 d6 ff 3e e5 b0 51 3f cc cc f0 3e 0c 04 51 3f d1 ee 57 3e 39 10 39 3f 00 00 c0 7f 00 00
80 7f 00 00 80 7f 00 00 80 ff
Output: TensorProtoTensor<FLOAT16,[3,4]>(name='x')
Output Numpy: [[0.479 0.4802 0.4998 0.8193]
[0.4702 0.8164 0.2108 0.723 ]
[ nan inf inf -inf]]
Output Bytes: aa 37 af 37 ff 37 8e 3a 86 37 88 3a bf 32 c9 39 00 7e 00 7c 00 7c 00 fc
Test test_cast_FLOAT_to_FLOAT4E2M1
Input: TensorProtoTensor<FLOAT,[3,5]>(name='x')
Input Numpy: [[ 4.80e-01 2.50e-01 1.05e+00 -3.50e+00 -8.00e+00]
[ 9.00e+00 1.00e+06 1.00e-07 nan inf]
[ inf -inf -4.00e+00 1.00e-02 -0.00e+00]]
Input Bytes: 8f c2 f5 3e 00 00 80 3e 66 66 86 3f 00 00 60 c0 00 00 00 c1 00 00 10 41 00 24 74 49 95 bf d6 33 00 00 c0 7f 00 00
80 7f 00 00 80 7f 00 00 80 ff 00 00 80 c0 0a d7 23 3c 00 00 00 80
Output: TensorProtoTensor<FLOAT4E2M1,[3,5]>(name='x')
Output Numpy: [[0 0 -6 -6 -1]
[-6 4 0 0 0]
[-1 -6 -2 -6 0]]
Output Bytes: 01 e2 7f 07 78 f7 0e 08
Test test_cast_FLOAT_to_FLOAT8E4M3FN
Input: TensorProtoTensor<FLOAT,[3,5]>(name='x')
Input Numpy: [[ 4.7892547e-01 4.8033667e-01 4.9968487e-01 8.1910545e-01
4.7031248e-01]
[ 7.2290379e-01 1.0000000e+06 1.0000000e-07 nan
inf]
[ inf -inf -1.0000000e-07 1.0000000e-07
-1.0000000e+06]]
Input Bytes: b8 35 f5 3e b0 ee f5 3e b2 d6 ff 3e e5 b0 51 3f cc cc f0 3e 39 10 39 3f 00 24 74 49 95 bf d6 33 00 00 c0 7f 00 00
80 7f 00 00 80 7f 00 00 80 ff 95 bf d6 b3 95 bf d6 33 00 24 74 c9
Output: TensorProtoTensor<FLOAT8E4M3FN,[3,5]>(name='x')
Output Numpy: [[0.46875 0.46875 0.5 0.8125 0.46875]
[0.75 448 0 nan 448]
[448 -448 -0 0 -448]]
Output Bytes: 2f 2f 30 35 2f 34 7e 00 7f 7e 7e fe 80 00 fe
Test test_cast_FLOAT_to_FLOAT8E4M3FNUZ
Input: TensorProtoTensor<FLOAT,[3,5]>(name='x')
Input Numpy: [[ 4.7892547e-01 4.8033667e-01 4.9968487e-01 8.1910545e-01
4.7031248e-01]
[ 7.2290379e-01 1.0000000e+06 1.0000000e-07 nan
inf]
[ inf -inf -1.0000000e-07 1.0000000e-07
-1.0000000e+06]]
Input Bytes: b8 35 f5 3e b0 ee f5 3e b2 d6 ff 3e e5 b0 51 3f cc cc f0 3e 39 10 39 3f 00 24 74 49 95 bf d6 33 00 00 c0 7f 00 00
80 7f 00 00 80 7f 00 00 80 ff 95 bf d6 b3 95 bf d6 33 00 24 74 c9
Output: TensorProtoTensor<FLOAT8E4M3FNUZ,[3,5]>(name='x')
Output Numpy: [[0.46875 0.46875 0.5 0.8125 0.46875]
[0.75 240 0 nan 240]
[240 -240 0 0 -240]]
Output Bytes: 37 37 38 3d 37 3c 7f 00 80 7f 7f ff 00 00 ff
Test test_cast_FLOAT_to_FLOAT8E5M2
Input: TensorProtoTensor<FLOAT,[3,5]>(name='x')
Input Numpy: [[ 4.7892547e-01 4.8033667e-01 4.9968487e-01 8.1910545e-01
4.7031248e-01]
[ 7.2290379e-01 1.0000000e+06 1.0000000e-07 nan
inf]
[ inf -inf -1.0000000e-07 1.0000000e-07
-1.0000000e+06]]
Input Bytes: b8 35 f5 3e b0 ee f5 3e b2 d6 ff 3e e5 b0 51 3f cc cc f0 3e 39 10 39 3f 00 24 74 49 95 bf d6 33 00 00 c0 7f 00 00
80 7f 00 00 80 7f 00 00 80 ff 95 bf d6 b3 95 bf d6 33 00 24 74 c9
Output: TensorProtoTensor<FLOAT8E5M2,[3,5]>(name='x')
Output Numpy: [[0.5 0.5 0.5 0.875 0.5]
[0.75 57344 0 nan 57344]
[57344 -57344 -0 0 -57344]]
Output Bytes: 38 38 38 3b 38 3a 7b 00 7e 7b 7b fb 80 00 fb
Test test_cast_FLOAT_to_FLOAT8E5M2FNUZ
Input: TensorProtoTensor<FLOAT,[3,5]>(name='x')
Input Numpy: [[ 4.7892547e-01 4.8033667e-01 4.9968487e-01 8.1910545e-01
4.7031248e-01]
[ 7.2290379e-01 1.0000000e+06 1.0000000e-07 nan
inf]
[ inf -inf -1.0000000e-07 1.0000000e-07
-1.0000000e+06]]
Input Bytes: b8 35 f5 3e b0 ee f5 3e b2 d6 ff 3e e5 b0 51 3f cc cc f0 3e 39 10 39 3f 00 24 74 49 95 bf d6 33 00 00 c0 7f 00 00
80 7f 00 00 80 7f 00 00 80 ff 95 bf d6 b3 95 bf d6 33 00 24 74 c9
Output: TensorProtoTensor<FLOAT8E5M2FNUZ,[3,5]>(name='x')
Output Numpy: [[0.5 0.5 0.5 0.875 0.5]
[0.75 57344 0 nan 57344]
[57344 -57344 0 0 -57344]]
Output Bytes: 3c 3c 3c 3f 3c 3e 7f 00 80 7f 7f ff 00 00 ff
Test test_cast_FLOAT_to_INT4
Input: TensorProtoTensor<FLOAT,[5,5]>(name='x')
Input Numpy: [[-9. -8. -7. -6. -5.]
[-4. -3. -2. -1. 0.]
[ 1. 2. 3. 4. 5.]
[ 6. 7. 8. 9. 10.]
[11. 12. 13. 14. 15.]]
Input Bytes: 00 00 10 c1 00 00 00 c1 00 00 e0 c0 00 00 c0 c0 00 00 a0 c0 00 00 80 c0 00 00 40 c0 00 00 00 c0 00 00 80 bf 00 00
00 00 00 00 80 3f 00 00 00 40 00 00 40 40 00 00 80 40 00 00 a0 40 00 00 c0 40 00 00 e0 40 00 00 00 41 00 00 10 41 00 00 20 41 00 00 30 41 00 00 40 41 00 00 50 41 00 00 60 41 00 00 70 41
Output: TensorProtoTensor<INT4,[5,5]>(name='x')
Output Numpy: [[7 0 -7 -1 -5]
[-1 -3 -1 -1 -1]
[1 0 3 0 5]
[0 7 0 -7 -1]
[-5 -1 -3 -1 -1]]
Output Bytes: 87 a9 cb ed 0f 21 43 65 87 a9 cb ed 0f
Test test_cast_FLOAT_to_UINT4
Input: TensorProtoTensor<FLOAT,[5,5]>(name='x')
Input Numpy: [[-9. -8. -7. -6. -5.]
[-4. -3. -2. -1. 0.]
[ 1. 2. 3. 4. 5.]
[ 6. 7. 8. 9. 10.]
[11. 12. 13. 14. 15.]]
Input Bytes: 00 00 10 c1 00 00 00 c1 00 00 e0 c0 00 00 c0 c0 00 00 a0 c0 00 00 80 c0 00 00 40 c0 00 00 00 c0 00 00 80 bf 00 00
00 00 00 00 80 3f 00 00 00 40 00 00 40 40 00 00 80 40 00 00 a0 40 00 00 c0 40 00 00 e0 40 00 00 00 41 00 00 10 41 00 00 20 41 00 00 30 41 00 00 40 41 00 00 50 41 00 00 60 41 00 00 70 41
Output: TensorProtoTensor<UINT4,[5,5]>(name='x')
Output Numpy: [[7 0 9 0 11]
[0 13 0 15 0]
[1 0 3 0 5]
[0 7 0 9 0]
[11 0 13 0 15]]
Output Bytes: 87 a9 cb ed 0f 21 43 65 87 a9 cb ed 0f
Test test_cast_INT4_to_FLOAT
Input: TensorProtoTensor<INT4,[5,5]>(name='x')
Input Numpy: [[7 0 -7 -1 -5]
[-1 -3 -1 -1 -1]
[1 0 3 0 5]
[0 7 0 -7 -1]
[-5 -1 -3 -1 -1]]
Input Bytes: 87 a9 cb ed 0f 21 43 65 87 a9 cb ed 0f
Output: TensorProtoTensor<FLOAT,[5,5]>(name='x')
Output Numpy: [[ 7. -8. -7. -6. -5.]
[-4. -3. -2. -1. 0.]
[ 1. 2. 3. 4. 5.]
[ 6. 7. -8. -7. -6.]
[-5. -4. -3. -2. -1.]]
Output Bytes: 00 00 e0 40 00 00 00 c1 00 00 e0 c0 00 00 c0 c0 00 00 a0 c0 00 00 80 c0 00 00 40 c0 00 00 00 c0 00 00 80 bf 00 0
0 00 00 00 00 80 3f 00 00 00 40 00 00 40 40 00 00 80 40 00 00 a0 40 00 00 c0 40 00 00 e0 40 00 00 00 c1 00 00 e0 c0 00 00 c0 c0 00 00 a0 c0 00 00 80 c0 00 00 40 c0 00 00 00 c0 00 00 80 bf
Test test_cast_INT4_to_FLOAT16
Input: TensorProtoTensor<INT4,[5,5]>(name='x')
Input Numpy: [[7 0 -7 -1 -5]
[-1 -3 -1 -1 -1]
[1 0 3 0 5]
[0 7 0 -7 -1]
[-5 -1 -3 -1 -1]]
Input Bytes: 87 a9 cb ed 0f 21 43 65 87 a9 cb ed 0f
Output: TensorProtoTensor<FLOAT16,[5,5]>(name='x')
Output Numpy: [[ 7. -8. -7. -6. -5.]
[-4. -3. -2. -1. 0.]
[ 1. 2. 3. 4. 5.]
[ 6. 7. -8. -7. -6.]
[-5. -4. -3. -2. -1.]]
Output Bytes: 00 47 00 c8 00 c7 00 c6 00 c5 00 c4 00 c2 00 c0 00 bc 00 00 00 3c 00 40 00 42 00 44 00 45 00 46 00 47 00 c8 00 c
7 00 c6 00 c5 00 c4 00 c2 00 c0 00 bc
Test test_cast_INT4_to_INT8
Input: TensorProtoTensor<INT4,[5,5]>(name='x')
Input Numpy: [[7 0 -7 -1 -5]
[-1 -3 -1 -1 -1]
[1 0 3 0 5]
[0 7 0 -7 -1]
[-5 -1 -3 -1 -1]]
Input Bytes: 87 a9 cb ed 0f 21 43 65 87 a9 cb ed 0f
Output: TensorProtoTensor<INT8,[5,5]>(name='x')
Output Numpy: [[ 7 -8 -7 -6 -5]
[-4 -3 -2 -1 0]
[ 1 2 3 4 5]
[ 6 7 -8 -7 -6]
[-5 -4 -3 -2 -1]]
Output Bytes: 07 f8 f9 fa fb fc fd fe ff 00 01 02 03 04 05 06 07 f8 f9 fa fb fc fd fe ff
Test test_cast_UINT4_to_FLOAT
Input: TensorProtoTensor<UINT4,[5,5]>(name='x')
Input Numpy: [[7 0 9 0 11]
[0 13 0 15 0]
[1 0 3 0 5]
[0 7 0 9 0]
[11 0 13 0 15]]
Input Bytes: 87 a9 cb ed 0f 21 43 65 87 a9 cb ed 0f
Output: TensorProtoTensor<FLOAT,[5,5]>(name='x')
Output Numpy: [[ 7. 8. 9. 10. 11.]
[12. 13. 14. 15. 0.]
[ 1. 2. 3. 4. 5.]
[ 6. 7. 8. 9. 10.]
[11. 12. 13. 14. 15.]]
Output Bytes: 00 00 e0 40 00 00 00 41 00 00 10 41 00 00 20 41 00 00 30 41 00 00 40 41 00 00 50 41 00 00 60 41 00 00 70 41 00 0
0 00 00 00 00 80 3f 00 00 00 40 00 00 40 40 00 00 80 40 00 00 a0 40 00 00 c0 40 00 00 e0 40 00 00 00 41 00 00 10 41 00 00 20 41 00 00 30 41 00 00 40 41 00 00 50 41 00 00 60 41 00 00 70 41
Test test_cast_UINT4_to_FLOAT16
Input: TensorProtoTensor<UINT4,[5,5]>(name='x')
Input Numpy: [[7 0 9 0 11]
[0 13 0 15 0]
[1 0 3 0 5]
[0 7 0 9 0]
[11 0 13 0 15]]
Input Bytes: 87 a9 cb ed 0f 21 43 65 87 a9 cb ed 0f
Output: TensorProtoTensor<FLOAT16,[5,5]>(name='x')
Output Numpy: [[ 7. 8. 9. 10. 11.]
[12. 13. 14. 15. 0.]
[ 1. 2. 3. 4. 5.]
[ 6. 7. 8. 9. 10.]
[11. 12. 13. 14. 15.]]
Output Bytes: 00 47 00 48 80 48 00 49 80 49 00 4a 80 4a 00 4b 80 4b 00 00 00 3c 00 40 00 42 00 44 00 45 00 46 00 47 00 48 80 4
8 00 49 80 49 00 4a 80 4a 00 4b 80 4b
Test test_cast_UINT4_to_UINT8
Input: TensorProtoTensor<UINT4,[5,5]>(name='x')
Input Numpy: [[7 0 9 0 11]
[0 13 0 15 0]
[1 0 3 0 5]
[0 7 0 9 0]
[11 0 13 0 15]]
Input Bytes: 87 a9 cb ed 0f 21 43 65 87 a9 cb ed 0f
Output: TensorProtoTensor<UINT8,[5,5]>(name='x')
Output Numpy: [[ 7 8 9 10 11]
[12 13 14 15 0]
[ 1 2 3 4 5]
[ 6 7 8 9 10]
[11 12 13 14 15]]
Output Bytes: 07 08 09 0a 0b 0c 0d 0e 0f 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f
Test test_cast_no_saturate_FLOAT16_to_FLOAT8E4M3FN
Input: TensorProtoTensor<FLOAT16,[3,5]>(name='x')
Input Numpy: [[ 4.790e-01 4.802e-01 4.998e-01 8.193e-01 4.702e-01]
[ 7.231e-01 inf 1.192e-07 nan inf]
[ inf -inf -1.192e-07 1.192e-07 -inf]]
Input Bytes: aa 37 af 37 ff 37 8e 3a 86 37 c9 39 00 7c 02 00 00 7e 00 7c 00 7c 00 fc 02 80 02 00 00 fc
Output: TensorProtoTensor<FLOAT8E4M3FN,[3,5]>(name='x')
Output Numpy: [[0.46875 0.46875 0.5 0.8125 0.46875]
[0.75 nan 0 nan nan]
[nan nan -0 0 nan]]
Output Bytes: 2f 2f 30 35 2f 34 7f 00 7f 7f 7f ff 80 00 ff
Test test_cast_no_saturate_FLOAT16_to_FLOAT8E4M3FNUZ
Input: TensorProtoTensor<FLOAT16,[3,5]>(name='x')
Input Numpy: [[ 4.790e-01 4.802e-01 4.998e-01 8.193e-01 4.702e-01]
[ 7.231e-01 inf 1.192e-07 nan inf]
[ inf -inf -1.192e-07 1.192e-07 -inf]]
Input Bytes: aa 37 af 37 ff 37 8e 3a 86 37 c9 39 00 7c 02 00 00 7e 00 7c 00 7c 00 fc 02 80 02 00 00 fc
Output: TensorProtoTensor<FLOAT8E4M3FNUZ,[3,5]>(name='x')
Output Numpy: [[0.46875 0.46875 0.5 0.8125 0.46875]
[0.75 nan 0 nan nan]
[nan nan 0 0 nan]]
Output Bytes: 37 37 38 3d 37 3c 80 00 80 80 80 80 00 00 80
Test test_cast_no_saturate_FLOAT16_to_FLOAT8E5M2
Input: TensorProtoTensor<FLOAT16,[3,5]>(name='x')
Input Numpy: [[ 4.790e-01 4.802e-01 4.998e-01 8.193e-01 4.702e-01]
[ 7.231e-01 inf 1.192e-07 nan inf]
[ inf -inf -1.192e-07 1.192e-07 -inf]]
Input Bytes: aa 37 af 37 ff 37 8e 3a 86 37 c9 39 00 7c 02 00 00 7e 00 7c 00 7c 00 fc 02 80 02 00 00 fc
Output: TensorProtoTensor<FLOAT8E5M2,[3,5]>(name='x')
Output Numpy: [[0.5 0.5 0.5 0.875 0.5]
[0.75 inf 0 nan inf]
[inf -inf -0 0 -inf]]
Output Bytes: 38 38 38 3b 38 3a 7c 00 7e 7c 7c fc 80 00 fc
Test test_cast_no_saturate_FLOAT16_to_FLOAT8E5M2FNUZ
Input: TensorProtoTensor<FLOAT16,[3,5]>(name='x')
Input Numpy: [[ 4.790e-01 4.802e-01 4.998e-01 8.193e-01 4.702e-01]
[ 7.231e-01 inf 1.192e-07 nan inf]
[ inf -inf -1.192e-07 1.192e-07 -inf]]
Input Bytes: aa 37 af 37 ff 37 8e 3a 86 37 c9 39 00 7c 02 00 00 7e 00 7c 00 7c 00 fc 02 80 02 00 00 fc
Output: TensorProtoTensor<FLOAT8E5M2FNUZ,[3,5]>(name='x')
Output Numpy: [[0.5 0.5 0.5 0.875 0.5]
[0.75 nan 0 nan nan]
[nan nan 0 0 nan]]
Output Bytes: 3c 3c 3c 3f 3c 3e 80 00 80 80 80 80 00 00 80
Test test_cast_no_saturate_FLOAT_to_FLOAT8E4M3FN
Input: TensorProtoTensor<FLOAT,[3,5]>(name='x')
Input Numpy: [[ 4.7892547e-01 4.8033667e-01 4.9968487e-01 8.1910545e-01
4.7031248e-01]
[ 7.2290379e-01 1.0000000e+06 1.0000000e-07 nan
inf]
[ inf -inf -1.0000000e-07 1.0000000e-07
-1.0000000e+06]]
Input Bytes: b8 35 f5 3e b0 ee f5 3e b2 d6 ff 3e e5 b0 51 3f cc cc f0 3e 39 10 39 3f 00 24 74 49 95 bf d6 33 00 00 c0 7f 00 00
80 7f 00 00 80 7f 00 00 80 ff 95 bf d6 b3 95 bf d6 33 00 24 74 c9
Output: TensorProtoTensor<FLOAT8E4M3FN,[3,5]>(name='x')
Output Numpy: [[0.46875 0.46875 0.5 0.8125 0.46875]
[0.75 nan 0 nan nan]
[nan nan -0 0 nan]]
Output Bytes: 2f 2f 30 35 2f 34 7f 00 7f 7f 7f ff 80 00 ff
Test test_cast_no_saturate_FLOAT_to_FLOAT8E4M3FNUZ
Input: TensorProtoTensor<FLOAT,[3,5]>(name='x')
Input Numpy: [[ 4.7892547e-01 4.8033667e-01 4.9968487e-01 8.1910545e-01
4.7031248e-01]
[ 7.2290379e-01 1.0000000e+06 1.0000000e-07 nan
inf]
[ inf -inf -1.0000000e-07 1.0000000e-07
-1.0000000e+06]]
Input Bytes: b8 35 f5 3e b0 ee f5 3e b2 d6 ff 3e e5 b0 51 3f cc cc f0 3e 39 10 39 3f 00 24 74 49 95 bf d6 33 00 00 c0 7f 00 00
80 7f 00 00 80 7f 00 00 80 ff 95 bf d6 b3 95 bf d6 33 00 24 74 c9
Output: TensorProtoTensor<FLOAT8E4M3FNUZ,[3,5]>(name='x')
Output Numpy: [[0.46875 0.46875 0.5 0.8125 0.46875]
[0.75 nan 0 nan nan]
[nan nan 0 0 nan]]
Output Bytes: 37 37 38 3d 37 3c 80 00 80 80 80 80 00 00 80
Test test_cast_no_saturate_FLOAT_to_FLOAT8E5M2
Input: TensorProtoTensor<FLOAT,[3,5]>(name='x')
Input Numpy: [[ 4.7892547e-01 4.8033667e-01 4.9968487e-01 8.1910545e-01
4.7031248e-01]
[ 7.2290379e-01 1.0000000e+06 1.0000000e-07 nan
inf]
[ inf -inf -1.0000000e-07 1.0000000e-07
-1.0000000e+06]]
Input Bytes: b8 35 f5 3e b0 ee f5 3e b2 d6 ff 3e e5 b0 51 3f cc cc f0 3e 39 10 39 3f 00 24 74 49 95 bf d6 33 00 00 c0 7f 00 00
80 7f 00 00 80 7f 00 00 80 ff 95 bf d6 b3 95 bf d6 33 00 24 74 c9
Output: TensorProtoTensor<FLOAT8E5M2,[3,5]>(name='x')
Output Numpy: [[0.5 0.5 0.5 0.875 0.5]
[0.75 inf 0 nan inf]
[inf -inf -0 0 -inf]]
Output Bytes: 38 38 38 3b 38 3a 7c 00 7e 7c 7c fc 80 00 fc
Test test_cast_no_saturate_FLOAT_to_FLOAT8E5M2FNUZ
Input: TensorProtoTensor<FLOAT,[3,5]>(name='x')
Input Numpy: [[ 4.7892547e-01 4.8033667e-01 4.9968487e-01 8.1910545e-01
4.7031248e-01]
[ 7.2290379e-01 1.0000000e+06 1.0000000e-07 nan
inf]
[ inf -inf -1.0000000e-07 1.0000000e-07
-1.0000000e+06]]
Input Bytes: b8 35 f5 3e b0 ee f5 3e b2 d6 ff 3e e5 b0 51 3f cc cc f0 3e 39 10 39 3f 00 24 74 49 95 bf d6 33 00 00 c0 7f 00 00
80 7f 00 00 80 7f 00 00 80 ff 95 bf d6 b3 95 bf d6 33 00 24 74 c9
Output: TensorProtoTensor<FLOAT8E5M2FNUZ,[3,5]>(name='x')
Output Numpy: [[0.5 0.5 0.5 0.875 0.5]
[0.75 nan 0 nan nan]
[nan nan 0 0 nan]]
Output Bytes: 3c 3c 3c 3f 3c 3e 80 00 80 80 80 80 00 00 80
Test test_cast_BFLOAT16_to_FLOAT
Input: TensorProtoTensor<UINT16,[3,4]>(name='input')
Input Numpy: [[16117 16117 16127 16209]
[16112 16209 15959 16185]
[32704 32640 32640 65408]]
[0.46875 0.81640625 0.20996094 0.72265625]
[ nan inf inf -inf]]
0 80 7f 00 00 80 7f 00 00 80 ff
Test test_cast_DOUBLE_to_FLOAT
Input: TensorProtoTensor<DOUBLE,[3,4]>(name='input')
Input Numpy: [[0.31542835 0.36371077 0.57019677 0.43860151]
[0.98837384 0.10204481 0.20887676 0.16130952]
[0.65310833 0.2532916 0.46631077 0.24442559]]
ef 3f 80 a8 e3 d4 9b 1f ba 3f 7c 33 29 3a 79 bc ca 3f 3c bf ec 4f ca a5 c4 3f 92 d0 53 6e 43 e6 e4 3f 7a a0 50 fb ed 35 d0 3f 34 2e cc 23 09 d8 dd 3f b8 e5 f9 79 56 49 cf 3f
Output: TensorProtoTensor<FLOAT,[3,4]>(name='output')
Output Numpy: [[0.31542835 0.36371076 0.57019675 0.43860152]
[0.9883738 0.10204481 0.20887676 0.16130951]
[0.6531083 0.2532916 0.46631077 0.2444256 ]]
f 81 3e 49 c0 ee 3e b4 4a 7a 3e
Test test_cast_DOUBLE_to_FLOAT16
Input: TensorProtoTensor<DOUBLE,[3,4]>(name='input')
Input Numpy: [[0.15896958 0.11037514 0.65632959 0.13818295]
[0.19658236 0.36872517 0.82099323 0.09710128]
[0.83794491 0.09609841 0.97645947 0.4686512 ]]
c9 3f e2 da 4c 75 31 99 d7 3f b9 e5 0d 98 93 45 ea 3f e8 5a ee 13 a1 db b8 3f d4 d3 b1 d6 71 d0 ea 3f 60 2c 1a bf e7 99 b8 3f 26 45 83 eb 27 3f ef 3f f0 b5 13 9c 61 fe dd 3f
Output: TensorProtoTensor<FLOAT16,[3,4]>(name='output')
Output Numpy: [[0.1589 0.11035 0.6562 0.1382 ]
[0.1965 0.3687 0.821 0.0971 ]
[0.838 0.09607 0.9766 0.4688 ]]
Test test_cast_FLOAT16_to_DOUBLE
Input: TensorProtoTensor<FLOAT16,[3,4]>(name='input')
Input Numpy: [[0.6123 0.6167 0.944 0.6816]
[0.3596 0.437 0.6978 0.0602]
[0.667 0.6704 0.2103 0.1289]]
[0.35961914 0.43701172 0.69775391 0.06021118]
[0.66699219 0.67041016 0.21032715 0.12890625]]
4 d7 3f 00 00 00 00 00 f8 db 3f 00 00 00 00 00 54 e6 3f 00 00 00 00 00 d4 ae 3f 00 00 00 00 00 58 e5 3f 00 00 00 00 00 74 e5 3f 00 00 00 00 00 ec ca 3f 00 00 00 00 00 80 c0 3f
Test test_cast_FLOAT16_to_FLOAT
Input: TensorProtoTensor<FLOAT16,[3,4]>(name='input')
Input Numpy: [[0.1183 0.64 0.1433 0.945 ]
[0.522 0.4146 0.2646 0.7744 ]
[0.456 0.5684 0.01878 0.6177 ]]
[0.52197266 0.41455078 0.26464844 0.77441406]
[0.4560547 0.5683594 0.01878357 0.6176758 ]]
0 11 3f 00 e0 99 3c 00 20 1e 3f
Test test_cast_FLOAT16_to_FLOAT4E2M1
Input: TensorProtoTensor<FLOAT16,[3,5]>(name='x')
Input Numpy: [[ 4.80e-01 2.50e-01 1.05e+00 -3.50e+00 -8.00e+00]
[ 9.00e+00 inf 1.19e-07 nan inf]
[ inf -inf -4.00e+00 1.00e-02 -0.00e+00]]
[6 6 0 6 6]
[6 -6 -4 0 -0]]
Test test_cast_FLOAT16_to_FLOAT8E4M3FN
Input: TensorProtoTensor<FLOAT16,[3,5]>(name='x')
Input Numpy: [[ 4.790e-01 4.802e-01 4.998e-01 8.193e-01 4.702e-01]
[ 7.231e-01 inf 1.192e-07 nan inf]
[ inf -inf -1.192e-07 1.192e-07 -inf]]
[0.75 448 0 nan 448]
[448 -448 -0 0 -448]]
Test test_cast_FLOAT16_to_FLOAT8E4M3FNUZ
Input: TensorProtoTensor<FLOAT16,[3,5]>(name='x')
Input Numpy: [[ 4.790e-01 4.802e-01 4.998e-01 8.193e-01 4.702e-01]
[ 7.231e-01 inf 1.192e-07 nan inf]
[ inf -inf -1.192e-07 1.192e-07 -inf]]
[0.75 240 0 nan 240]
[240 -240 0 0 -240]]
Test test_cast_FLOAT16_to_FLOAT8E5M2
Input: TensorProtoTensor<FLOAT16,[3,5]>(name='x')
Input Numpy: [[ 4.790e-01 4.802e-01 4.998e-01 8.193e-01 4.702e-01]
[ 7.231e-01 inf 1.192e-07 nan inf]
[ inf -inf -1.192e-07 1.192e-07 -inf]]
[0.75 57344 0 nan 57344]
[57344 -57344 -0 0 -57344]]
Test test_cast_FLOAT16_to_FLOAT8E5M2FNUZ
Input: TensorProtoTensor<FLOAT16,[3,5]>(name='x')
Input Numpy: [[ 4.790e-01 4.802e-01 4.998e-01 8.193e-01 4.702e-01]
[ 7.231e-01 inf 1.192e-07 nan inf]
[ inf -inf -1.192e-07 1.192e-07 -inf]]
[0.75 57344 0 nan 57344]
[57344 -57344 0 0 -57344]]
Test test_cast_FLOAT16_to_INT4
Input: TensorProtoTensor<FLOAT16,[5,5]>(name='input')
Input Numpy: [[-9. -8. -7. -6. -5.]
[-4. -3. -2. -1. 0.]
[ 1. 2. 3. 4. 5.]
[ 6. 7. 8. 9. 10.]
[11. 12. 13. 14. 15.]]
00 49 80 49 00 4a 80 4a 00 4b 80 4b
Output: TensorProtoTensor<INT4,[5,5]>(name='output')
Output Numpy: [[-8 -8 -7 -6 -5]
[-4 -3 -2 -1 0]
[1 2 3 4 5]
[6 7 7 7 7]
[7 7 7 7 7]]
Test test_cast_FLOAT16_to_UINT4
Input: TensorProtoTensor<FLOAT16,[5,5]>(name='input')
Input Numpy: [[-9. -8. -7. -6. -5.]
[-4. -3. -2. -1. 0.]
[ 1. 2. 3. 4. 5.]
[ 6. 7. 8. 9. 10.]
[11. 12. 13. 14. 15.]]
00 49 80 49 00 4a 80 4a 00 4b 80 4b
Output: TensorProtoTensor<UINT4,[5,5]>(name='output')
Output Numpy: [[0 0 0 0 0]
[0 0 0 0 0]
[1 2 3 4 5]
[6 7 8 9 10]
[11 12 13 14 15]]
Test test_cast_FLOAT4E2M1_to_FLOAT
Input: TensorProtoTensor<FLOAT4E2M1,[3,5]>(name='x')
Input Numpy: [[0.5 0 1 -4 -6]
[6 6 0 6 6]
[6 -6 -4 0 -0]]
[ 6. 6. 0. 6. 6. ]
[ 6. -6. -4. 0. -0. ]]
0 c0 40 00 00 c0 40 00 00 c0 c0 00 00 80 c0 00 00 00 00 00 00 00 80
Test test_cast_FLOAT4E2M1_to_FLOAT16
Input: TensorProtoTensor<FLOAT4E2M1,[3,5]>(name='x')
Input Numpy: [[0.5 0 1 -4 -6]
[6 6 0 6 6]
[6 -6 -4 0 -0]]
[ 6. 6. 0. 6. 6. ]
[ 6. -6. -4. 0. -0. ]]
Test test_cast_FLOAT8E4M3FNUZ_to_FLOAT
Input: TensorProtoTensor<FLOAT8E4M3FNUZ,[3,5]>(name='x')
Input Numpy: [[0.46875 0.46875 0.5 0.8125 0.46875]
[0.75 240 0 nan 240]
[240 -240 0 0 -240]]
[ 0.75 240. 0. nan 240. ]
[ 240. -240. 0. 0. -240. ]]
0 70 43 00 00 70 43 00 00 70 c3 00 00 00 00 00 00 00 00 00 00 70 c3
Test test_cast_FLOAT8E4M3FNUZ_to_FLOAT16
Input: TensorProtoTensor<FLOAT8E4M3FNUZ,[3,5]>(name='x')
Input Numpy: [[0.46875 0.46875 0.5 0.8125 0.46875]
[0.75 240 0 nan 240]
[240 -240 0 0 -240]]
[ 0.75 240. 0. nan 240. ]
[ 240. -240. 0. 0. -240. ]]
Test test_cast_FLOAT8E4M3FN_to_FLOAT
Input: TensorProtoTensor<FLOAT8E4M3FN,[3,5]>(name='x')
Input Numpy: [[0.46875 0.46875 0.5 0.8125 0.46875]
[0.75 448 0 nan 448]
[448 -448 -0 0 -448]]
[ 0.75 448. 0. nan 448. ]
[ 448. -448. -0. 0. -448. ]]
0 e0 43 00 00 e0 43 00 00 e0 c3 00 00 00 80 00 00 00 00 00 00 e0 c3
Test test_cast_FLOAT8E4M3FN_to_FLOAT16
Input: TensorProtoTensor<FLOAT8E4M3FN,[3,5]>(name='x')
Input Numpy: [[0.46875 0.46875 0.5 0.8125 0.46875]
[0.75 448 0 nan 448]
[448 -448 -0 0 -448]]
[ 0.75 448. 0. nan 448. ]
[ 448. -448. -0. 0. -448. ]]
Test test_cast_FLOAT8E5M2FNUZ_to_FLOAT
Input: TensorProtoTensor<FLOAT8E5M2FNUZ,[3,5]>(name='x')
Input Numpy: [[0.5 0.5 0.5 0.875 0.5]
[0.75 57344 0 nan 57344]
[57344 -57344 0 0 -57344]]
[ 7.5000e-01 5.7344e+04 0.0000e+00 nan 5.7344e+04]
[ 5.7344e+04 -5.7344e+04 0.0000e+00 0.0000e+00 -5.7344e+04]]
0 60 47 00 00 60 47 00 00 60 c7 00 00 00 00 00 00 00 00 00 00 60 c7
Test test_cast_FLOAT8E5M2FNUZ_to_FLOAT16
Input: TensorProtoTensor<FLOAT8E5M2FNUZ,[3,5]>(name='x')
Input Numpy: [[0.5 0.5 0.5 0.875 0.5]
[0.75 57344 0 nan 57344]
[57344 -57344 0 0 -57344]]
[ 7.500e-01 5.734e+04 0.000e+00 nan 5.734e+04]
[ 5.734e+04 -5.734e+04 0.000e+00 0.000e+00 -5.734e+04]]
Test test_cast_FLOAT8E5M2_to_FLOAT
Input: TensorProtoTensor<FLOAT8E5M2,[3,5]>(name='x')
Input Numpy: [[0.5 0.5 0.5 0.875 0.5]
[0.75 57344 0 nan 57344]
[57344 -57344 -0 0 -57344]]
[ 7.5000e-01 5.7344e+04 0.0000e+00 nan 5.7344e+04]
[ 5.7344e+04 -5.7344e+04 -0.0000e+00 0.0000e+00 -5.7344e+04]]
0 60 47 00 00 60 47 00 00 60 c7 00 00 00 80 00 00 00 00 00 00 60 c7
Test test_cast_FLOAT8E5M2_to_FLOAT16
Input: TensorProtoTensor<FLOAT8E5M2,[3,5]>(name='x')
Input Numpy: [[0.5 0.5 0.5 0.875 0.5]
[0.75 57344 0 nan 57344]
[57344 -57344 -0 0 -57344]]
[ 7.500e-01 5.734e+04 0.000e+00 nan 5.734e+04]
[ 5.734e+04 -5.734e+04 -0.000e+00 0.000e+00 -5.734e+04]]
Test test_cast_FLOAT_to_BFLOAT16
Input: TensorProtoTensor<FLOAT,[3,4]>(name='input')
Input Numpy: [[0.47892547 0.48033667 0.49968487 0.81910545]
[0.47031248 0.816468 0.21087195 0.7229038 ]
[ nan inf inf -inf]]
80 7f 00 00 80 7f 00 00 80 ff
Output: TensorProtoTensor<UINT16,[3,4]>(name='output')
Output Numpy: [[16117 16117 16127 16209]
[16112 16209 15959 16185]
[32704 32640 32640 65408]]
Test test_cast_FLOAT_to_DOUBLE
Input: TensorProtoTensor<FLOAT,[3,4]>(name='input')
Input Numpy: [[0.56804454 0.92559665 0.07103606 0.0871293 ]
[0.0202184 0.83261985 0.77815676 0.87001216]
[0.9786183 0.7991586 0.46147937 0.7805292 ]]
4c 3f 06 47 ec 3e c3 d0 47 3f
Output: TensorProtoTensor<DOUBLE,[3,4]>(name='output')
Output Numpy: [[0.56804454 0.92559665 0.07103606 0.0871293 ]
[0.0202184 0.83261985 0.77815676 0.87001216]
[0.97861832 0.79915857 0.46147937 0.7805292 ]]
4 94 3f 00 00 00 60 d2 a4 ea 3f 00 00 00 00 a9 e6 e8 3f 00 00 00 c0 23 d7 eb 3f 00 00 00 60 d7 50 ef 3f 00 00 00 00 b5 92 e9 3f 00 00 00 c0 e0 88 dd 3f 00 00 00 60 18 fa e8 3f
Test test_cast_FLOAT_to_FLOAT16
Input: TensorProtoTensor<FLOAT,[3,4]>(name='input')
Input Numpy: [[0.5488135 0.71518934 0.60276335 0.5448832 ]
[0.4236548 0.6458941 0.4375872 0.891773 ]
[0.96366274 0.3834415 0.79172504 0.5288949 ]]
c4 3e 7e ae 4a 3f a8 65 07 3f
Output: TensorProtoTensor<FLOAT16,[3,4]>(name='output')
Output Numpy: [[0.549 0.7153 0.6025 0.545 ]
[0.4236 0.646 0.4375 0.8916]
[0.964 0.3835 0.7915 0.529 ]]
Test test_cast_FLOAT_to_FLOAT4E2M1
Input: TensorProtoTensor<FLOAT,[3,5]>(name='x')
Input Numpy: [[ 4.80e-01 2.50e-01 1.05e+00 -3.50e+00 -8.00e+00]
[ 9.00e+00 1.00e+06 1.00e-07 nan inf]
[ inf -inf -4.00e+00 1.00e-02 -0.00e+00]]
80 7f 00 00 80 7f 00 00 80 ff 00 00 80 c0 0a d7 23 3c 00 00 00 80
Output: TensorProtoTensor<FLOAT4E2M1,[3,5]>(name='y')
Output Numpy: [[0.5 0 1 -4 -6]
[6 6 0 6 6]
[6 -6 -4 0 -0]]
Test test_cast_FLOAT_to_FLOAT8E4M3FN
Input: TensorProtoTensor<FLOAT,[3,5]>(name='x')
Input Numpy: [[ 4.7892547e-01 4.8033667e-01 4.9968487e-01 8.1910545e-01
4.7031248e-01]
[ 7.2290379e-01 1.0000000e+06 1.0000000e-07 nan
inf]
[ inf -inf -1.0000000e-07 1.0000000e-07
-1.0000000e+06]]
80 7f 00 00 80 7f 00 00 80 ff 95 bf d6 b3 95 bf d6 33 00 24 74 c9
Output: TensorProtoTensor<FLOAT8E4M3FN,[3,5]>(name='x')
Output Numpy: [[0.46875 0.46875 0.5 0.8125 0.46875]
[0.75 448 0 nan 448]
[448 -448 -0 0 -448]]
Test test_cast_FLOAT_to_FLOAT8E4M3FNUZ
Input: TensorProtoTensor<FLOAT,[3,5]>(name='x')
Input Numpy: [[ 4.7892547e-01 4.8033667e-01 4.9968487e-01 8.1910545e-01
4.7031248e-01]
[ 7.2290379e-01 1.0000000e+06 1.0000000e-07 nan
inf]
[ inf -inf -1.0000000e-07 1.0000000e-07
-1.0000000e+06]]
80 7f 00 00 80 7f 00 00 80 ff 95 bf d6 b3 95 bf d6 33 00 24 74 c9
Output: TensorProtoTensor<FLOAT8E4M3FNUZ,[3,5]>(name='x')
Output Numpy: [[0.46875 0.46875 0.5 0.8125 0.46875]
[0.75 240 0 nan 240]
[240 -240 0 0 -240]]
Test test_cast_FLOAT_to_FLOAT8E5M2
Input: TensorProtoTensor<FLOAT,[3,5]>(name='x')
Input Numpy: [[ 4.7892547e-01 4.8033667e-01 4.9968487e-01 8.1910545e-01
4.7031248e-01]
[ 7.2290379e-01 1.0000000e+06 1.0000000e-07 nan
inf]
[ inf -inf -1.0000000e-07 1.0000000e-07
-1.0000000e+06]]
80 7f 00 00 80 7f 00 00 80 ff 95 bf d6 b3 95 bf d6 33 00 24 74 c9
Output: TensorProtoTensor<FLOAT8E5M2,[3,5]>(name='x')
Output Numpy: [[0.5 0.5 0.5 0.875 0.5]
[0.75 57344 0 nan 57344]
[57344 -57344 -0 0 -57344]]
Test test_cast_FLOAT_to_FLOAT8E5M2FNUZ
Input: TensorProtoTensor<FLOAT,[3,5]>(name='x')
Input Numpy: [[ 4.7892547e-01 4.8033667e-01 4.9968487e-01 8.1910545e-01
4.7031248e-01]
[ 7.2290379e-01 1.0000000e+06 1.0000000e-07 nan
inf]
[ inf -inf -1.0000000e-07 1.0000000e-07
-1.0000000e+06]]
80 7f 00 00 80 7f 00 00 80 ff 95 bf d6 b3 95 bf d6 33 00 24 74 c9
Output: TensorProtoTensor<FLOAT8E5M2FNUZ,[3,5]>(name='x')
Output Numpy: [[0.5 0.5 0.5 0.875 0.5]
[0.75 57344 0 nan 57344]
[57344 -57344 0 0 -57344]]
Test test_cast_FLOAT_to_INT4
Input: TensorProtoTensor<FLOAT,[5,5]>(name='input')
Input Numpy: [[-9. -8. -7. -6. -5.]
[-4. -3. -2. -1. 0.]
[ 1. 2. 3. 4. 5.]
[ 6. 7. 8. 9. 10.]
[11. 12. 13. 14. 15.]]
00 00 00 00 80 3f 00 00 00 40 00 00 40 40 00 00 80 40 00 00 a0 40 00 00 c0 40 00 00 e0 40 00 00 00 41 00 00 10 41 00 00 20 41 00 00 30 41 00 00 40 41 00 00 50 41 00 00 60 41 00 00 70 41
Output: TensorProtoTensor<INT4,[5,5]>(name='output')
Output Numpy: [[-8 -8 -7 -6 -5]
[-4 -3 -2 -1 0]
[1 2 3 4 5]
[6 7 7 7 7]
[7 7 7 7 7]]
Test test_cast_FLOAT_to_UINT4
Input: TensorProtoTensor<FLOAT,[5,5]>(name='input')
Input Numpy: [[-9. -8. -7. -6. -5.]
[-4. -3. -2. -1. 0.]
[ 1. 2. 3. 4. 5.]
[ 6. 7. 8. 9. 10.]
[11. 12. 13. 14. 15.]]
00 00 00 00 80 3f 00 00 00 40 00 00 40 40 00 00 80 40 00 00 a0 40 00 00 c0 40 00 00 e0 40 00 00 00 41 00 00 10 41 00 00 20 41 00 00 30 41 00 00 40 41 00 00 50 41 00 00 60 41 00 00 70 41
Output: TensorProtoTensor<UINT4,[5,5]>(name='output')
Output Numpy: [[0 0 0 0 0]
[0 0 0 0 0]
[1 2 3 4 5]
[6 7 8 9 10]
[11 12 13 14 15]]
Test test_cast_INT4_to_FLOAT
Input: TensorProtoTensor<INT4,[5,5]>(name='input')
Input Numpy: [[-8 -8 -7 -6 -5]
[-4 -3 -2 -1 0]
[1 2 3 4 5]
[6 7 7 7 7]
[7 7 7 7 7]]
[-4. -3. -2. -1. 0.]
[ 1. 2. 3. 4. 5.]
[ 6. 7. 7. 7. 7.]
[ 7. 7. 7. 7. 7.]]
0 00 00 00 00 80 3f 00 00 00 40 00 00 40 40 00 00 80 40 00 00 a0 40 00 00 c0 40 00 00 e0 40 00 00 e0 40 00 00 e0 40 00 00 e0 40 00 00 e0 40 00 00 e0 40 00 00 e0 40 00 00 e0 40 00 00 e0 40
Test test_cast_INT4_to_FLOAT16
Input: TensorProtoTensor<INT4,[5,5]>(name='input')
Input Numpy: [[-8 -8 -7 -6 -5]
[-4 -3 -2 -1 0]
[1 2 3 4 5]
[6 7 7 7 7]
[7 7 7 7 7]]
[-4. -3. -2. -1. 0.]
[ 1. 2. 3. 4. 5.]
[ 6. 7. 7. 7. 7.]
[ 7. 7. 7. 7. 7.]]
7 00 47 00 47 00 47 00 47 00 47 00 47
Test test_cast_INT4_to_INT8
Input: TensorProtoTensor<INT4,[5,5]>(name='input')
Input Numpy: [[-8 -8 -7 -6 -5]
[-4 -3 -2 -1 0]
[1 2 3 4 5]
[6 7 7 7 7]
[7 7 7 7 7]]
[-4 -3 -2 -1 0]
[ 1 2 3 4 5]
[ 6 7 7 7 7]
[ 7 7 7 7 7]]
Test test_cast_UINT4_to_FLOAT
Input: TensorProtoTensor<UINT4,[5,5]>(name='input')
Input Numpy: [[0 0 0 0 0]
[0 0 0 0 0]
[1 2 3 4 5]
[6 7 8 9 10]
[11 12 13 14 15]]
[ 0. 0. 0. 0. 0.]
[ 1. 2. 3. 4. 5.]
[ 6. 7. 8. 9. 10.]
[11. 12. 13. 14. 15.]]
0 00 00 00 00 80 3f 00 00 00 40 00 00 40 40 00 00 80 40 00 00 a0 40 00 00 c0 40 00 00 e0 40 00 00 00 41 00 00 10 41 00 00 20 41 00 00 30 41 00 00 40 41 00 00 50 41 00 00 60 41 00 00 70 41
Test test_cast_UINT4_to_FLOAT16
Input: TensorProtoTensor<UINT4,[5,5]>(name='input')
Input Numpy: [[0 0 0 0 0]
[0 0 0 0 0]
[1 2 3 4 5]
[6 7 8 9 10]
[11 12 13 14 15]]
[ 0. 0. 0. 0. 0.]
[ 1. 2. 3. 4. 5.]
[ 6. 7. 8. 9. 10.]
[11. 12. 13. 14. 15.]]
8 00 49 80 49 00 4a 80 4a 00 4b 80 4b
Test test_cast_UINT4_to_UINT8
Input: TensorProtoTensor<UINT4,[5,5]>(name='input')
Input Numpy: [[0 0 0 0 0]
[0 0 0 0 0]
[1 2 3 4 5]
[6 7 8 9 10]
[11 12 13 14 15]]
[ 0 0 0 0 0]
[ 1 2 3 4 5]
[ 6 7 8 9 10]
[11 12 13 14 15]]
Test test_cast_no_saturate_FLOAT16_to_FLOAT8E4M3FN
Input: TensorProtoTensor<FLOAT16,[3,5]>(name='x')
Input Numpy: [[ 4.790e-01 4.802e-01 4.998e-01 8.193e-01 4.702e-01]
[ 7.231e-01 inf 1.192e-07 nan inf]
[ inf -inf -1.192e-07 1.192e-07 -inf]]
[0.75 nan 0 nan nan]
[nan nan -0 0 nan]]
Test test_cast_no_saturate_FLOAT16_to_FLOAT8E4M3FNUZ
Input: TensorProtoTensor<FLOAT16,[3,5]>(name='x')
Input Numpy: [[ 4.790e-01 4.802e-01 4.998e-01 8.193e-01 4.702e-01]
[ 7.231e-01 inf 1.192e-07 nan inf]
[ inf -inf -1.192e-07 1.192e-07 -inf]]
[0.75 nan 0 nan nan]
[nan nan 0 0 nan]]
Test test_cast_no_saturate_FLOAT16_to_FLOAT8E5M2
Input: TensorProtoTensor<FLOAT16,[3,5]>(name='x')
Input Numpy: [[ 4.790e-01 4.802e-01 4.998e-01 8.193e-01 4.702e-01]
[ 7.231e-01 inf 1.192e-07 nan inf]
[ inf -inf -1.192e-07 1.192e-07 -inf]]
[0.75 inf 0 nan inf]
[inf -inf -0 0 -inf]]
Test test_cast_no_saturate_FLOAT16_to_FLOAT8E5M2FNUZ
Input: TensorProtoTensor<FLOAT16,[3,5]>(name='x')
Input Numpy: [[ 4.790e-01 4.802e-01 4.998e-01 8.193e-01 4.702e-01]
[ 7.231e-01 inf 1.192e-07 nan inf]
[ inf -inf -1.192e-07 1.192e-07 -inf]]
[0.75 nan 0 nan nan]
[nan nan 0 0 nan]]
Test test_cast_no_saturate_FLOAT_to_FLOAT8E4M3FN
Input: TensorProtoTensor<FLOAT,[3,5]>(name='x')
Input Numpy: [[ 4.7892547e-01 4.8033667e-01 4.9968487e-01 8.1910545e-01
4.7031248e-01]
[ 7.2290379e-01 1.0000000e+06 1.0000000e-07 nan
inf]
[ inf -inf -1.0000000e-07 1.0000000e-07
-1.0000000e+06]]
80 7f 00 00 80 7f 00 00 80 ff 95 bf d6 b3 95 bf d6 33 00 24 74 c9
Output: TensorProtoTensor<FLOAT8E4M3FN,[3,5]>(name='x')
Output Numpy: [[0.46875 0.46875 0.5 0.8125 0.46875]
[0.75 nan 0 nan nan]
[nan nan -0 0 nan]]
Test test_cast_no_saturate_FLOAT_to_FLOAT8E4M3FNUZ
Input: TensorProtoTensor<FLOAT,[3,5]>(name='x')
Input Numpy: [[ 4.7892547e-01 4.8033667e-01 4.9968487e-01 8.1910545e-01
4.7031248e-01]
[ 7.2290379e-01 1.0000000e+06 1.0000000e-07 nan
inf]
[ inf -inf -1.0000000e-07 1.0000000e-07
-1.0000000e+06]]
80 7f 00 00 80 7f 00 00 80 ff 95 bf d6 b3 95 bf d6 33 00 24 74 c9
Output: TensorProtoTensor<FLOAT8E4M3FNUZ,[3,5]>(name='x')
Output Numpy: [[0.46875 0.46875 0.5 0.8125 0.46875]
[0.75 nan 0 nan nan]
[nan nan 0 0 nan]]
Test test_cast_no_saturate_FLOAT_to_FLOAT8E5M2
Input: TensorProtoTensor<FLOAT,[3,5]>(name='x')
Input Numpy: [[ 4.7892547e-01 4.8033667e-01 4.9968487e-01 8.1910545e-01
4.7031248e-01]
[ 7.2290379e-01 1.0000000e+06 1.0000000e-07 nan
inf]
[ inf -inf -1.0000000e-07 1.0000000e-07
-1.0000000e+06]]
80 7f 00 00 80 7f 00 00 80 ff 95 bf d6 b3 95 bf d6 33 00 24 74 c9
Output: TensorProtoTensor<FLOAT8E5M2,[3,5]>(name='x')
Output Numpy: [[0.5 0.5 0.5 0.875 0.5]
[0.75 inf 0 nan inf]
[inf -inf -0 0 -inf]]
Test test_cast_no_saturate_FLOAT_to_FLOAT8E5M2FNUZ
Input: TensorProtoTensor<FLOAT,[3,5]>(name='x')
Input Numpy: [[ 4.7892547e-01 4.8033667e-01 4.9968487e-01 8.1910545e-01
4.7031248e-01]
[ 7.2290379e-01 1.0000000e+06 1.0000000e-07 nan
inf]
[ inf -inf -1.0000000e-07 1.0000000e-07
-1.0000000e+06]]
80 7f 00 00 80 7f 00 00 80 ff 95 bf d6 b3 95 bf d6 33 00 24 74 c9
Output: TensorProtoTensor<FLOAT8E5M2FNUZ,[3,5]>(name='x')
Output Numpy: [[0.5 0.5 0.5 0.875 0.5]
[0.75 nan 0 nan nan]
[nan nan 0 0 nan]]