CNTK icon indicating copy to clipboard operation
CNTK copied to clipboard

How to use 16 Bit inference in c++ ?

Open CodeByMaxx opened this issue 7 years ago • 4 comments

Simple question is there any flag to force CNTK to use 16 bit accuracy for inference ?

Best regards

CodeByMaxx avatar Jun 13 '19 08:06 CodeByMaxx

You can Cast the variables to float16 and then cast the output back to float again but I'm not sure you will find much of a speedup. It might be easier to save you model to ONNX and convert it to 16bit using WinMLTools

YanYas avatar Jun 27 '19 14:06 YanYas

For inference, please use ONNX Runtime (https://github.com/microsoft/onnxruntime ). Float16 on the CPU is simply casted to Float32.

ebarsoumMS avatar Jun 28 '19 22:06 ebarsoumMS

Ok, thx and if i want to use half precision on the gpu ?

CodeByMaxx avatar Jun 30 '19 01:06 CodeByMaxx

fp16 on the GPU should work.

ebarsoumMS avatar Jun 30 '19 04:06 ebarsoumMS