我试着用张量流来运行KI。我的输入是一个10x10像素的帧。所以我的s = tf.placeholder("float", [None, **10, 10**, 4]).
但是我得到了以下错误并且不理解这个问题。有什么帮助吗
错误“输入形状为[?,1,1,32],[4,4,32,64]的'Conv2D_49'(op:'Conv2D')从1减去4导致负尺寸大小。”
#create tensorflow graph
def createGraph():
#first convolutional layer. bias vector
#creates an empty tensor with all elements set to zero with a shape
W_conv1 = tf.Variable(tf.zeros([8, 8, 4, 32]))
b_conv1 = tf.Variable(tf.zeros([32]))
W_conv2 = tf.Variable(tf.zeros([4, 4, 32, 64]))
b_conv2 = tf.Variable(tf.zeros([64]))
W_conv3 = tf.Variable(tf.zeros([3, 3, 64, 64]))
b_conv3 = tf.Variable(tf.zeros([64]))
W_fc4 = tf.Variable(tf.zeros([3136, 784]))
b_fc4 = tf.Variable(tf.zeros([784]))
W_fc5 = tf.Variable(tf.zeros([784, ACTIONS]))
b_fc5 = tf.Variable(tf.zeros([ACTIONS]))
#input for pixel data
s = tf.placeholder("float", [None, 10, 10, 4])
#Computes rectified linear unit activation fucntion on a 2-D convolution given 4-D input and filter tensors. and
conv1 = tf.nn.relu(tf.nn.conv2d(s, W_conv1, strides = [1, 4, 4, 1], padding = "VALID") + b_conv1)
conv2 = tf.nn.relu(tf.nn.conv2d(conv1, W_conv2, strides = [1, 2, 2, 1], padding = "VALID") + b_conv2)
conv3 = tf.nn.relu(tf.nn.conv2d(conv2, W_conv3, strides = [1, 1, 1, 1], padding = "VALID") + b_conv3)
conv3_flat = tf.reshape(conv3, [-1, 3136])
fc4 = tf.nn.relu(tf.matmul(conv3_flat, W_fc4) + b_fc4)
fc5 = tf.matmul(fc4, W_fc5) + b_fc5
return s, fc5
目前没有回答
相关问题 更多 >
编程相关推荐