Float16 image classification inference example python code
Created by: kexinzhao
The usual scenario on the python end for float16 inference is as follows:
- We first train a model in float32 mode
- We use a float16_transpiler to modify the program desc and generate new float16 weights in the scope
- We run the inference engine in float16 mode to validate the correctness
- Use can save the program desc and the float16 weights to be used next time either on the python or c++ end.
2. We convert the float32 weights into float16, and save them on disk
3. During inference, we load the float16 weights and model, run inference engine in float16 mode.
We want to have example code on the python side to demonstrate the above steps.