简体   繁体   中英

TFLearn “cannot feed value of shape.”

I started using a very basic Deep Belief Network in Node.js but it wasn't fast enough. Essentially it was using a X and Y where each is an array of arrays; X is the data to train and Y is the result.

So I would feed it something like var x=[[1,2,3], [1,3,2]] etc. etc. and y=[[1,0], [1,0]] . Then I would give some data such as [2,3,1] and it would predict the y .

I'm lost on how to do this in tfslearn. I can learn on my own but I've hit a point where I'm not sure what to even Google.

I can get the examples working if it's just a single array.

Every time I try using an array of arrays I get:

cannot feed value of shape

I was setting the input shape incorrectly for my data set. This helped a lot: http://tflearn.org/tutorials/quickstart.html

# Data loading and preprocessing
# Building deep neural network
net = tflearn.input_data(shape=[None, 4])
net = tflearn.fully_connected(net, 32)
net = tflearn.fully_connected(net, 32)
net = tflearn.fully_connected(net, 1, activation='softmax')
net = tflearn.regression(net)

# Training
model = tflearn.DNN(net)
model.fit(X, Y, n_epoch=10, batch_size=16, show_metric=True)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM