def __init__(self, interface): super().__init__(interface) self.bootstrap_state_input = tf.placeholder( tf.float32, [*self.interface.state_shape]) self.features = parts.conv_body(self.state_input) self.nonspacial_probs, self.spacial_probs_x, self.spacial_probs_y = self._probs_from_features( self.features)
def features(self): conv_features = parts.conv_body(self.state_input) unit_features = tf.reduce_sum(self.self_attention( self.unit_embeddings_input, bias=0), axis=1) logits = tf.concat( [conv_features, unit_features, self.other_features_input], axis=1) logits = tf.layers.dense(logits, units=200, activation=tf.nn.leaky_relu, name='feature_layer') logits = tf.layers.dense(logits, units=200, activation=tf.nn.tanh, name='feature_layer2') return logits
def features(self): conv_features = parts.conv_body(self.state_input) unit_features = tf.reduce_sum(self.self_attention( self.unit_embeddings_input, bias=0), axis=1) return tf.concat([conv_features, unit_features], axis=1)
def bootstrap_value(self): return tf.squeeze(parts.value_head( parts.conv_body(tf.expand_dims(self.bootstrap_state_input, axis=0))), axis=0)