这是我在Tensorflow中的神经网络:
tf.reset_default_graph()
x = tf.placeholder(tf.float32)
x_ = tf.placeholder(tf.float32)
th = tf.placeholder(tf.float32)
th_ = tf.placeholder(tf.float32)
rlu_1 = tf.contrib.layers.fully_connected
rlu_1.num_outputs = 10
# 4 state features: x, x_, th, th_
rlu_1.inputs = [x,x_,th,th_]
rlu_1.weights_initializer = tf.random_uniform(shape=[4],minval=-1,maxval=1) # is this 4 or 10?
rlu_2 = tf.contrib.layers.fully_connected # hope that makes a copy
rlu_2.inputs = rlu_1
rlu_2.num_outputs = 10
rlu_2.weights_initializer = tf.random_uniform(shape=[10],minval=-1,maxval=1)
Qcptr = tf.contrib.layers.fully_connected
Qcptr.inputs = rlu_2
Qcptr.num_outputs = 2
Qcptr.activation_fn = tf.identity
我想输出最后一层的值。我怎么做? 我无法安装tflearn,因为我在Windows机器上使用Anaconda。
答案 0 :(得分:0)
我修好了!事实证明我缺少了为fully_connected的括号。代替 rlu_1 = tf.contrib.layers.fully_connected
我应该做的 rlu_1 = tf.contrib.layers.fully_connected(inputs = ..,num_outputs = ..)