0
votes

I have following error:

File "D:\python\WPy64-3740\python-3.7.4.amd64\lib\site-packages\tensorflow\python\client\session.py", line 1149, in _run str(subfeed_t.get_shape())))

ValueError: Cannot feed value of shape (4, 11, 11) for Tensor 'input/X:0', which has shape '(?, 4, 11, 11)'

My code is:

with tf.Graph().as_default():
g=tflearn.input_data(shape=[4,11,11],name='input')

g=tflearn.fully_connected(g,512,activation='relu',name="hidden1")
g=tflearn.fully_connected(g,256,activation='relu',name="hidden2")
g=tflearn.fully_connected(g,121,activation='softmax',name="output")
g=tflearn.regression(g,optimizer='adam',learning_rate=1,metric='R2',loss='categorical_crossentropy')

m=tflearn.DNN(g)
m.fit(train_state,train_nextmove,n_epoch=10,batch_size=50,snapshot_epoch=False,shuffle=True)

x0=train_state[34]
pred0=m.predict(x0)
1

1 Answers

0
votes

I sloved this problem by myself. Actually the construction of this network is correct, the problem is in the second last line:

x0=train_state[34]
pred0=m.predict(x0)

when I change these two line to:

x0=[train_state[34]]
pred0=m.predict(x0)

then it works.

please be aware that when the training data is a (n* 4* 11* 11) list, the data be predicted should also follow the same format: not (4* 11* 11), but (1* 4* 11* 11), or (m* 4* 11* 11) where m is an arbitrary positive integer.