I want to create a reinforcement project, but I struggle with some problems.
I have a class for my neural network. Consisting of one Input Layer, two Hidden Layer and one output-Layer. It is created with tflearn.
class Network():
self.inputs, self.outputs = self.createNetwork()
[...]
def createNetwork(self):
# Input-Layer
inputs = tflearn.input_data(shape=[None, 3])
# Hidden-Layer L1
net = tflearn.fully_connected(inputs, 400, activation='relu')
# Hidden Layer L2
net = tflearn.fully_connected(net, 300, activation='relu')
# Final layer weights are init to Uniform[-3e-3, 3e-3]
weight_init_final = tflearn.initializations.uniform(minval=-0.003, maxval=0.003)
output = tflearn.fully_connected(net, 1, activation='tanh', weights_init=weight_init_final)
return inputs, output
And the method for predicting a value
def predict(self, inputs):
return self.sess.run(self.outputs, feed_dict={
self.inputs: inputs
})
I train with a batch size of 32 and want to predict a value.
network.predict(test_batch)
Sadly I get an error 'Cannot feed value of shape (32, 1, 3) for Tensor u'/X:0', which has shape '(?, 3)' test_batch.shape results in (32, 1, 3)
Your input layer is expecting a shape of (?,3) --> inputs = tflearn.input_data(shape=[None, 3])
The input_shape should be (None, 1, 3)
to match the shape of your data.