python save_inference_model可以正常运行,但是__model__文件里有错误
Created by: shuoyin
我使用python的save_inference_model接口保存模型,然后打开文件夹下的__model__文件,发现里边有错误信息,但是在python里可以正常save和load Paddle 1.4, CPU, python2 代码如下:
import paddle.fluid as fluid
import numpy as np
data = np.random.rand(4,10).astype('float32')
x = fluid.layers.data(shape=[-1,10], name='x')
y = fluid.layers.fc(input=x, size=2)
place = fluid.CPUPlace()
exe = fluid.Executor(place)
exe.run(fluid.default_startup_program())
print exe.run(fluid.default_main_program(), feed={'x':data}, fetch_list=[y])
fluid.io.save_inference_model('test_save', ['x'], [y], exe)
print 'load inference'
inf_prog, feed, fetch = fluid.io.load_inference_model('test_save', exe)
print feed, fetch
print exe.run(inf_prog, feed={feed[0]:data}, fetch_list=fetch)