'Embeds x using standard CNN architecture.
Args:
x: Batch of images as a 2-d Tensor [batch_size, -1].
Returns:
A 2-d Tensor [batch_size, hidden_dim] of embedded images.'

def core_builder(self, x):

    ch1 = (32 * 2)
    ch2 = (64 * 2)
    conv1_weights = tf.get_variable('conv1_w', [3, 3, self.num_channels, ch1], initializer=self.matrix_init)
    conv1_biases = tf.get_variable('conv1_b', [ch1], initializer=self.vector_init)
    conv1a_weights = tf.get_variable('conv1a_w', [3, 3, ch1, ch1], initializer=self.matrix_init)
    conv1a_biases = tf.get_variable('conv1a_b', [ch1], initializer=self.vector_init)
    conv2_weights = tf.get_variable('conv2_w', [3, 3, ch1, ch2], initializer=self.matrix_init)
    conv2_biases = tf.get_variable('conv2_b', [ch2], initializer=self.vector_init)
    conv2a_weights = tf.get_variable('conv2a_w', [3, 3, ch2, ch2], initializer=self.matrix_init)
    conv2a_biases = tf.get_variable('conv2a_b', [ch2], initializer=self.vector_init)
    fc1_weights = tf.get_variable('fc1_w', [((((self.image_size // 4) * self.image_size) // 4) * ch2), self.hidden_dim], initializer=self.matrix_init)
    fc1_biases = tf.get_variable('fc1_b', [self.hidden_dim], initializer=self.vector_init)
    x = tf.reshape(x, [(-1), self.image_size, self.image_size, self.num_channels])
    batch_size = tf.shape(x)[0]
    conv1 = tf.nn.conv2d(x, conv1_weights, strides=[1, 1, 1, 1], padding='SAME')
    relu1 = tf.nn.relu(tf.nn.bias_add(conv1, conv1_biases))
    conv1 = tf.nn.conv2d(relu1, conv1a_weights, strides=[1, 1, 1, 1], padding='SAME')
    relu1 = tf.nn.relu(tf.nn.bias_add(conv1, conv1a_biases))
    pool1 = tf.nn.max_pool(relu1, ksize=[1, 2, 2, 1], strides=[1, 2, 2, 1], padding='SAME')
    conv2 = tf.nn.conv2d(pool1, conv2_weights, strides=[1, 1, 1, 1], padding='SAME')
    relu2 = tf.nn.relu(tf.nn.bias_add(conv2, conv2_biases))
    conv2 = tf.nn.conv2d(relu2, conv2a_weights, strides=[1, 1, 1, 1], padding='SAME')
    relu2 = tf.nn.relu(tf.nn.bias_add(conv2, conv2a_biases))
    pool2 = tf.nn.max_pool(relu2, ksize=[1, 2, 2, 1], strides=[1, 2, 2, 1], padding='SAME')
    reshape = tf.reshape(pool2, [batch_size, (-1)])
    hidden = (tf.matmul(reshape, fc1_weights) + fc1_biases)
    return hidden
