Open WuNein opened 1 year ago
Float16 and BFloat16 are often represented as unsigned 16-bit integers. Please, indicate what is missing in the documentation, because there is a code sample.
We do not provide conversion API, it is outside the scope of the API regardless of the language. We will incorporate the latest type in .NET when it is fully supported.
greatly thanks, i saw the converting code in https://github.com/microsoft/onnxruntime/blob/main/csharp/test/Microsoft.ML.OnnxRuntime.Tests.Common/OrtFloat16Tests.cs I will test it later.
greatly thanks, i saw the converting code in https://github.com/microsoft/onnxruntime/blob/main/csharp/test/Microsoft.ML.OnnxRuntime.Tests.Common/OrtFloat16Tests.cs I will test it later.
Hello @WuNein, were you able to test out the converting code? I am looking for the same functionality to convert an array of inputs from float32 to float16 precision and then back to float32 to feed into the onnx model.
Our tensor model was trained on float16 but onnx models only support 32bit inputs.
@gjiremadzeBECKMAN onnx convert to float16 is easy https://github.com/microsoft/onnxconverter-common/blob/209a47e18e6a4c3474273a0b2a5e8f1fda481643/onnxconverter_common/auto_mixed_precision_model_path.py#L23
I haven't try the c# code, to be honest.
Describe the feature request
C# Float16 related function. Currently, Float16 in C# do not have any demo, while the value saved in Float16 is in ushort format. Float16 Struct
my converting code below made 0.56 -> 0, which is incorrent as np.float16 result in python, (I think it become float -> ushort in c#)
API functions missing: 1.Convert float(.net native) to Float16 2.Convert Float16 to float(.net native)
Describe scenario use case
ONNXruntime-gpu, CUDA, c#, influence, windows , .net6, using fp16 to accurate