def build_network(name_scope, env):
w_init_dense = tf.truncated_normal_initializer() #contrib.layers.xavier_initializer()
b_init = tf.constant_initializer(value=0.0)
with tf.variable_scope(name_scope):
input_tensor = tf.placeholder(tf.float32,
shape=tf_utils.get_input_tensor_shape(env),
name='policy_input_'+name_scope)
net = tf.contrib.layers.fully_connected(input_tensor,
32, #env.action_space.n, #32,
activation_fn=tf.nn.tanh, #sigmoid,
weights_initializer=w_init_dense,
biases_initializer=b_init,
scope='dense1_'+name_scope)
net = tf.contrib.layers.fully_connected(net,
env.action_space.n,
weights_initializer=w_init_dense,
biases_initializer=b_init,
scope='dense2_'+name_scope)
net = tf.contrib.layers.softmax(net)
return [input_tensor], [net]
评论列表
文章目录