def __init__(self, input_space, output_space, trainable=True, use_nature=True):
if isinstance(input_space, Tuple) or isinstance(output_space, Tuple):
raise ValueError('For tuple action and observation spaces '
'consider implementing custom network architecture.')
self._input_ph = tf.placeholder('float32', shape=[None] + list(input_space.shape),
name='inputs')
if use_nature:
net, end_points = make_dqn_body_nature(self.input_ph, trainable)
else:
net, end_points = make_dqn_body(self.input_ph, trainable)
net = layers.fully_connected(net, num_outputs=512, activation_fn=tf.nn.relu,
scope='fc1', trainable=trainable)
end_points['fc1'] = net
end_points['out'] = layers.fully_connected(net,
num_outputs=output_space.shape[0],
activation_fn=None, scope='out',
trainable=trainable)
self.end_points = end_points
评论列表
文章目录