我正在研究TensorFlow中的项目,该项目对已训练的机器学习模型执行操作。遵循教程TFLearn Quickstart,我建立了一个深度神经网络,预测Titanic Dataset的生存。我想以与使用TensorFlow模型相同的方式使用TFLearn模型。如何将TensorFlow张量传递给TFLearn模型
的TFLearn文件首页说
Full transparency over Tensorflow. All functions are built over tensors and can be used independently of TFLearn
这让我觉得,我将能够通过张量作为输入等所涉及的TFLearn模型。
# Build neural network
net = tflearn.input_data(shape=[None, 6])
net = tflearn.fully_connected(net, 32)
net = tflearn.fully_connected(net, 32)
net = tflearn.fully_connected(net, 2, activation='softmax')
net = tflearn.regression(net)
# Define model
model = tflearn.DNN(net)
# Start training (apply gradient descent algorithm)
model.fit(data, labels, n_epoch = 10, batch_size = 16, show_metric = False)
test = preprocess([[3, 'Jack Dawson', 'male', 19, 0, 0, 'N/A', 5.0000]], to_ignore)
# Make into a tensor
testTF = [tf.constant(i) for i in test]
# Pass the tensor into the predictor
print(model.predict([testTF]))
目前,当我通过一个张量到模型我正在与ValueError异常问候:设置与序列的数组元素。
具体来说,如何将张量传递到TFLearn模型? 一般来说,我如何在TFLearn模型上使用张量有什么限制?