def __init__(self, namespace, input_state, opts):
super(ValueNetwork, self).__init__(namespace)
with tf.variable_scope(namespace):
# do potential horizontal flipping of input state
# recall input is (batch, height, width, rgb) and we want to flip on width
flipped_input_state = tf.cond(base_network.FLIP_HORIZONTALLY,
lambda: tf.reverse(input_state, dims=[False, False, True, False]),
lambda: input_state)
# expose self.input_state_representation since it will be the network "shared"
# by l_value & output_action network when running --share-input-state-representation
self.conv_net_output = self.conv_net_on(flipped_input_state, opts)
self.hidden_layers = self.hidden_layers_on(self.conv_net_output, [100, 50])
self.value = slim.fully_connected(scope='fc',
inputs=self.hidden_layers,
num_outputs=1,
weights_regularizer=tf.contrib.layers.l2_regularizer(0.01),
activation_fn=None) # (batch, 1)
评论列表
文章目录