def build_model(self):
    '\n        Build the custom CNN for the CIFAR-10 dataset.\n        '
    self.X = tf.compat.v1.placeholder(tf.float32, shape=(None, self.config.data['image_size'], self.config.data['image_size'], self.config.data['num_channels']), name='X')
    self.y = tf.compat.v1.placeholder(tf.int32, shape=(None, self.config.data['num_categories']), name='y')
    self.train = tf.compat.v1.placeholder(tf.bool)
    with tf.name_scope('cnn'):
        self.conv1 = tf.layers.conv2d(self.X, self.config.cifar10_cnn['num_filters'], self.config.cifar10_cnn['filter_size'], padding='same', activation=tf.nn.relu)
        self.drop1 = tf.layers.dropout(self.conv1, self.config.cifar10_cnn['keep_prob'], training=self.train)
        self.pool1 = tf.layers.max_pooling2d(self.drop1, 2, 2)
        self.conv2 = tf.layers.conv2d(self.pool1, self.config.cifar10_cnn['num_filters'], self.config.cifar10_cnn['filter_size'], padding='same', activation=tf.nn.relu)
        self.drop2 = tf.layers.dropout(self.conv2, self.config.cifar10_cnn['keep_prob'], training=self.train)
        self.pool2 = tf.layers.max_pooling2d(self.drop2, 2, 2)
        self.conv3 = tf.layers.conv2d(self.pool2, self.config.cifar10_cnn['num_filters'], self.config.cifar10_cnn['filter_size'], padding='same', activation=tf.nn.relu)
        self.pool3 = tf.layers.max_pooling2d(self.conv3, 2, 2)
        self.conv4 = tf.layers.conv2d(self.pool3, self.config.cifar10_cnn['num_filters'], self.config.cifar10_cnn['filter_size'], padding='same', activation=tf.nn.relu)
        self.drop3 = tf.layers.dropout(self.conv4, self.config.cifar10_cnn['keep_prob'], training=self.train)
        self.flatten = tf.reshape(self.drop3, [(- 1), self.config.cifar10_cnn['fc1_nb_units']])
        with tf.contrib.framework.arg_scope([tf.contrib.layers.fully_connected], normalizer_fn=tf.contrib.layers.batch_norm, normalizer_params={'is_training': self.train}):
            self.fc1 = tf.contrib.layers.fully_connected(self.flatten, self.config.cifar10_cnn['fc1_nb_units'])
            self.fc2 = tf.contrib.layers.fully_connected(self.fc1, self.config.data['num_categories'], activation_fn=None)
        with tf.name_scope('loss'):
            self.loss = tf.reduce_mean(tf.nn.softmax_cross_entropy_with_logits(logits=self.fc2, labels=self.y))
        with tf.name_scope('training_op'):
            self.training_op = tf.compat.v1.train.AdamOptimizer(self.learning_rate).minimize(self.loss)
        with tf.name_scope('accuracy'):
            prediction = tf.equal(tf.argmax(self.fc2, 1), tf.argmax(self.y, 1))
            self.accuracy = tf.reduce_mean(tf.cast(prediction, tf.float32))
Build the custom CNN for the CIFAR-10 dataset.
def build_model(self):
    '\n        \n        '
    self.X = tf.compat.v1.placeholder(tf.float32, shape=(None, self.config.data['image_size'], self.config.data['image_size'], self.config.data['num_channels']), name='X')
    self.y = tf.compat.v1.placeholder(tf.int32, shape=(None, self.config.data['num_categories']), name='y')
    self.train = tf.compat.v1.placeholder(tf.bool)
    with tf.name_scope('cnn'):
        self.conv1 = tf.layers.conv2d(self.X, self.config.cifar10_cnn['num_filters'], self.config.cifar10_cnn['filter_size'], padding='same', activation=tf.nn.relu)
        self.drop1 = tf.layers.dropout(self.conv1, self.config.cifar10_cnn['keep_prob'], training=self.train)
        self.pool1 = tf.layers.max_pooling2d(self.drop1, 2, 2)
        self.conv2 = tf.layers.conv2d(self.pool1, self.config.cifar10_cnn['num_filters'], self.config.cifar10_cnn['filter_size'], padding='same', activation=tf.nn.relu)
        self.drop2 = tf.layers.dropout(self.conv2, self.config.cifar10_cnn['keep_prob'], training=self.train)
        self.pool2 = tf.layers.max_pooling2d(self.drop2, 2, 2)
        self.conv3 = tf.layers.conv2d(self.pool2, self.config.cifar10_cnn['num_filters'], self.config.cifar10_cnn['filter_size'], padding='same', activation=tf.nn.relu)
        self.pool3 = tf.layers.max_pooling2d(self.conv3, 2, 2)
        self.conv4 = tf.layers.conv2d(self.pool3, self.config.cifar10_cnn['num_filters'], self.config.cifar10_cnn['filter_size'], padding='same', activation=tf.nn.relu)
        self.drop3 = tf.layers.dropout(self.conv4, self.config.cifar10_cnn['keep_prob'], training=self.train)
        self.flatten = tf.reshape(self.drop3, [(- 1), self.config.cifar10_cnn['fc1_nb_units']])
        with tf.contrib.framework.arg_scope([tf.contrib.layers.fully_connected], normalizer_fn=tf.contrib.layers.batch_norm, normalizer_params={'is_training': self.train}):
            self.fc1 = tf.contrib.layers.fully_connected(self.flatten, self.config.cifar10_cnn['fc1_nb_units'])
            self.fc2 = tf.contrib.layers.fully_connected(self.fc1, self.config.data['num_categories'], activation_fn=None)
        with tf.name_scope('loss'):
            self.loss = tf.reduce_mean(tf.nn.softmax_cross_entropy_with_logits(logits=self.fc2, labels=self.y))
        with tf.name_scope('training_op'):
            self.training_op = tf.compat.v1.train.AdamOptimizer(self.learning_rate).minimize(self.loss)
        with tf.name_scope('accuracy'):
            prediction = tf.equal(tf.argmax(self.fc2, 1), tf.argmax(self.y, 1))
            self.accuracy = tf.reduce_mean(tf.cast(prediction, tf.float32))