【发布时间】:2017-12-19 13:58:00
【问题描述】:
我正在尝试保存模型并使用 tflearn 库将其加载到其他进程中......
于是我生成了模型:
lenx = 21908
leny = 81
# Build neural network
net = tflearn.input_data(shape=[None, lenx])
net = tflearn.fully_connected(net, 8)
net = tflearn.fully_connected(net, 8)
net = tflearn.fully_connected(net, leny, activation='softmax')
net = tflearn.regression(net)
# Define model and setup tensorboard
model = tflearn.DNN(net, tensorboard_dir='tflearn_logs')
# Start training (apply gradient descent algorithm)
model.fit(train_x, train_y, n_epoch=10, batch_size=8, show_metric=True)
model.save('model.tflearn')
这行得通! 然后在其他文件中,要在其他进程中运行,我正在尝试以这种方式加载它:
lenx = 21908
leny = 81
# Build neural network
net = tflearn.input_data(shape=[None, lenx])
net = tflearn.fully_connected(net, 8)
net = tflearn.fully_connected(net, 8)
net = tflearn.fully_connected(net, leny, activation='softmax')
net = tflearn.regression(net)
model = tflearn.DNN(net, tensorboard_dir='tflearn_logs')
model.load("model.tflearn")
但我得到了这个错误:
ValueError: Cannot feed value of shape (1, 0) for Tensor 'InputData/X:0', which has shape '(?, 21908)'
我尝试了很多方法,但都不起作用。
【问题讨论】:
-
您好,您对此有答复吗?
标签: python tensorflow tflearn