Creates the queue and preprocessing operations for the dataset.

    Args:
        data_path: Filename for cifar10 data.
        size: The number of images in the dataset.
        dataset: The dataset we are using.

    Returns:
        queue: A Tensorflow queue for extracting the images and labels.

def build_data(data_path, size, dataset):
    """Creates the queue and preprocessing operations for the dataset.

    Args:
        data_path: Filename for cifar10 data.
        size: The number of images in the dataset.
        dataset: The dataset we are using.

    Returns:
        queue: A Tensorflow queue for extracting the images and labels.
    """
    image_size = 32
    if dataset == "cifar10":
        label_bytes = 1
        label_offset = 0
    elif dataset == "cifar100":
        label_bytes = 1
        label_offset = 1
    depth = 3
    image_bytes = image_size * image_size * depth
    record_bytes = label_bytes + label_offset + image_bytes

    def load_transform(value):
        # Convert these examples to dense labels and processed images.
        record = tf.reshape(tf.decode_raw(value, tf.uint8), [record_bytes])
        label = tf.cast(tf.slice(record, [label_offset], [label_bytes]),
                        tf.int32)
        # Convert from string to [depth * height * width] to
        # [depth, height, width].
        depth_major = tf.reshape(
            tf.slice(record, [label_bytes], [image_bytes]),
            [depth, image_size, image_size])
        # Convert from [depth, height, width] to [height, width, depth].
        image = tf.cast(tf.transpose(depth_major, [1, 2, 0]), tf.float32)
        return (image, label)
    # Read examples from files in the filename queue.
    data_files = tf.gfile.Glob(data_path)
    data = tf.contrib.data.FixedLengthRecordDataset(data_files,
                                                    record_bytes=record_bytes)
    data = data.map(load_transform)
    data = data.batch(size)
    iterator = data.make_one_shot_iterator()
    return iterator.get_next()