//  [python]
def NAS(path,
        batch_norm=True,
        batch_size=128,
        num_threads=4,
        min_queue_examples=1000,
        mode="train"):
    """Cifar10 classification with a convolutional network."""

    # Data.
    _maybe_download_cifar10(path)

    # Read images and labels from disk.
    if mode == "train":
        filenames = [os.path.join(path, CIFAR10_FOLDER, "data_batch_{}.bin".format(i)) for i in xrange(1, 6)]
    elif mode == "test":
        filenames = [os.path.join(path, CIFAR10_FOLDER, "test_batch.bin")]
    else:
        raise ValueError("Mode {} not recognised".format(mode))

    depth = 3
    height = 32
    width = 32
    label_bytes = 1
    image_bytes = depth * height * width
    record_bytes = label_bytes + image_bytes
    reader = tf.FixedLengthRecordReader(record_bytes=record_bytes)
    _, record = reader.read(tf.train.string_input_producer(filenames))
    record_bytes = tf.decode_raw(record, tf.uint8)

    label = tf.cast(tf.slice(record_bytes, [0], [label_bytes]), tf.int32)
    raw_image = tf.slice(record_bytes, [label_bytes], [image_bytes])
    image = tf.cast(tf.reshape(raw_image, [depth, height, width]), tf.float32)
    # height x width x depth.
    image = tf.transpose(image, [1, 2, 0])
    image = tf.div(image, 255)

    queue = tf.RandomShuffleQueue(capacity=min_queue_examples + 3 * batch_size,
                                  min_after_dequeue=min_queue_examples,
                                  dtypes=[tf.float32, tf.int32],
                                  shapes=[image.get_shape(), label.get_shape()])
    enqueue_ops = [queue.enqueue([image, label]) for _ in xrange(num_threads)]
    tf.train.add_queue_runner(tf.train.QueueRunner(queue, enqueue_ops))

    # Network
    def network(inputs, training=True):
        def conv_layer(inputs, strides, c_h, c_w, output_channels, padding, name):
            n_channels = int(inputs.get_shape()[-1])
            with tf.variable_scope(name) as scope:
                kernel1 = tf.get_variable('weights1',
                                          shape=[c_h, c_w, n_channels, output_channels],
                                          dtype=tf.float32,
                                          initializer=tf.random_normal_initializer(stddev=0.01)
                                          )

                biases1 = tf.get_variable('biases1', [output_channels], initializer=tf.constant_initializer(0.0))
            inputs = tf.nn.conv2d(inputs, kernel1, [1, strides, strides, 1], padding)
            inputs = tf.nn.bias_add(inputs, biases1)
            if batch_norm:
                inputs = tf.layers.batch_normalization(inputs, training=training)
            inputs = tf.nn.relu(inputs)
            return inputs

        def _pooling(x):
            return tf.nn.avg_pool(x,
                                  ksize=[1, 3, 3, 1],
                                  strides=[1, 1, 1, 1],
                                  padding="SAME")

        node0 = conv_layer(inputs, 1, 3, 3, 16, "SAME", 'node0')
        node0_onto_node2 = conv_layer(node0, 1, 3, 3, 16, "SAME", 'node0_onto_node2')
        node1 = conv_layer(node0, 1, 3, 3, 16, "SAME", 'node1')
        node1_onto_node3 = conv_layer(node1, 1, 3, 3, 16, "SAME", 'node1_onto_node3')
        node2 = _pooling(node1) + node0_onto_node2
        node3 = node2 + node1_onto_node3 + node0
        node_final = tf.reduce_mean(tf.reshape(node3, [batch_size, -1, 16]), axis=1)

        fc_shape2 = int(node_final.get_shape()[1])
        weights = tf.get_variable("fc_weights",
                                  shape=[fc_shape2, 10],
                                  dtype=tf.float32,
                                  initializer=tf.random_normal_initializer(stddev=0.01))
        bias = tf.get_variable("fc_bias",
                               shape=[10, ],
                               dtype=tf.float32,
                               initializer=tf.constant_initializer(0.0))
        return tf.nn.relu(tf.nn.bias_add(tf.matmul(node_final, weights), bias))

    def build():
        image_batch, label_batch = queue.dequeue_many(batch_size)
        label_batch = tf.reshape(label_batch, [batch_size])

        output = network(image_batch)
        return _xent_loss(output, label_batch)

    return build