def tiny_mlp(self, x): fc1, w1, b1 = model_part.fc('fc1', x, [x.get_shape()[1], self.hidden_layer_dim], [self.hidden_layer_dim]) logits, w2, b2 = model_part.fc( 'fc2', fc1, [self.hidden_layer_dim, self.output_dim], [self.output_dim]) return logits, [w1, b1, w2, b2]
def inference(images, reuse=False, trainable=True): coarse1_conv = conv2d('coarse1', images, [11, 11, 3, 96], [96], [1, 4, 4, 1], padding='VALID', reuse=reuse, trainable=trainable) coarse1 = tf.nn.max_pool(coarse1_conv, ksize=[1, 3, 3, 1], strides=[1, 2, 2, 1], padding='VALID', name='pool1') coarse2_conv = conv2d('coarse2', coarse1, [5, 5, 96, 256], [256], [1, 1, 1, 1], padding='VALID', reuse=reuse, trainable=trainable) coarse2 = tf.nn.max_pool(coarse2_conv, ksize=[1, 3, 3, 1], strides=[1, 2, 2, 1], padding='SAME', name='pool1') coarse3 = conv2d('coarse3', coarse2, [3, 3, 256, 384], [384], [1, 1, 1, 1], padding='VALID', reuse=reuse, trainable=trainable) coarse4 = conv2d('coarse4', coarse3, [3, 3, 384, 384], [384], [1, 1, 1, 1], padding='VALID', reuse=reuse, trainable=trainable) coarse5 = conv2d('coarse5', coarse4, [3, 3, 384, 256], [256], [1, 1, 1, 1], padding='VALID', reuse=reuse, trainable=trainable) coarse6 = fc('coarse6', coarse5, [6*10*256, 4096], [4096], reuse=reuse, trainable=trainable) coarse7 = fc('coarse7', coarse6, [4096, 4070], [4070], reuse=reuse, trainable=trainable) coarse7_output = tf.reshape(coarse7, [-1, 55, 74, 1]) return coarse7_output
def mlp(self, x, reuse=False): fc1, w1, b1 = model_part.fc('fc1', x, [x.get_shape()[1], self.hidden_layer_dim], [self.hidden_layer_dim], reuse=reuse) fc2, w2, b2 = model_part.fc( 'fc2', fc1, [self.hidden_layer_dim, self.hidden_layer_dim2], [self.hidden_layer_dim2], reuse=reuse) logits, w3, b3 = model_part.fc( 'fc3', fc2, [self.hidden_layer_dim2, self.output_dim], [self.output_dim], reuse=reuse) return logits, [w1, b1, w2, b2, w3, b3]
def mlp(scope_name, x, input_dim, h1_dim, output_dim): with tf.variable_scope(scope_name) as scope: fc1 = fc('fc1', x, [input_dim, h1_dim], [h1_dim]) # neural network output is approximate of q function q = fc('fc2', fc1, [h1_dim, output_dim], [output_dim]) return q