import onnx
from onnxconverter_common import float16
from onnxoptimizer import optimize
model_path = '../model/rtm.onnx'
model_path_out = '../model/rtm-f16.onnx'
model = onnx.load(model_path)
model_fp16 = float16.convert_float_to_float16(model)
onnx.save(model_fp16, model_path_out)
# 加载ONNX模型
onnx_model = onnx.load(model_path_out)
optimized_model = optimize(onnx_model)
onnx.checker.check_model(model)
onnx.save(optimized_model, model_path_out)
onnx f32 f16
于 2024-04-25 09:18:47 首次发布