17 lines
503 B
Python
17 lines
503 B
Python
from paddlelite.lite import Opt
|
||
|
||
if __name__ == '__main__':
|
||
# 1. 创建opt实例
|
||
opt = Opt()
|
||
# 2. 指定输入模型地址
|
||
opt.set_model_dir("./model")
|
||
# 3. 指定转化类型: arm、x86、opencl、npu
|
||
# 一般认为arm为cpu,opencl为gpu
|
||
opt.set_valid_places("arm")
|
||
# 4. 指定模型转化类型: naive_buffer、protobuf
|
||
opt.set_model_type("naive_buffer")
|
||
# 4. 输出模型地址
|
||
opt.set_optimize_out("model")
|
||
# 5. 执行模型优化
|
||
opt.run()
|