def __init__(self,
                 images,
                 labels,
                 num_classes=0,
                 one_hot=False,
                 dtype=np.float32,
                 reshape=False):
        """Data object construction.
         images: The images of size [num_samples, rows, columns, depth].
         labels: The labels of size [num_samples,]
         num_classes: The number of classes in case one_hot labeling is desired.
         one_hot=False: Turn the labels into one_hot format.
         dtype=np.float32: The data type.
         reshape=False: Reshape in case the feature vector extraction is desired.

        """
        # Define the date type.
        if dtype not in (np.uint8, np.float32):
            raise TypeError('Invalid image dtype %r, expected uint8 or float32' %
                            dtype)
        assert images.shape[0] == labels.shape[0], (
            'images.shape: %s labels.shape: %s' % (images.shape, labels.shape))
        self._num_samples = images.shape[0]

        # [num_examples, rows, columns, depth] -> [num_examples, rows*columns]
        if reshape:
            assert images.shape[3] == 1
            images = images.reshape(images.shape[0],
                                    images.shape[1] * images.shape[2])

        # Conver to float if necessary
        if dtype == np.float32:
            # Convert from [0, 255] -> [0.0, 1.0].
            images = images.astype(dtype)
            images = np.multiply(images, 1.0 / 255.0)
        self._images = images
        self._labels = labels

        # If the one_hot flag is true, then the one_hot labeling supersedes the normal labeling.
        if one_hot:
            # If the one_hot labeling is desired, number of classes must be defined as one of the arguments of DATA_OBJECT class!
            assert num_classes != 0, (
                'You must specify the num_classes in the DATA_OBJECT for one_hot label construction!')

            # Define the indexes.
            index = np.arange(self._num_samples) * num_classes
            one_hot_labels = np.zeros((self._num_samples, num_classes))
            one_hot_labels.flat[index + labels.ravel()] = 1
            self._labels = one_hot_labels
Data object construction.
         images: The images of size [num_samples, rows, columns, depth].
         labels: The labels of size [num_samples,]
         num_classes: The number of classes in case one_hot labeling is desired.
         one_hot=False: Turn the labels into one_hot format.
         dtype=np.float32: The data type.
         reshape=False: Reshape in case the feature vector extraction is desired.

        
codes/3-neural_networks/convolutional-neural-network/code/input_function/input.py