
"""
Functions for loading input data.

Author: <NAME> <<EMAIL>>
"""

import os

import numpy as np


def load_img(path: str, img_nums: list, shape: tuple) -> np.array:
    """
    Loads a image in the human-readable format.

    Args:
        path:
            The path to the to the folder with mnist images.
        img_nums:
            A list with the numbers of the images we want to load.
        shape:
            The shape of a single image.

    Returns:
        The images as a MxCx28x28 numpy array.
    """

    images = np.zeros((len(img_nums), *shape), dtype=float)

    for idx, i in enumerate(img_nums):
        file = os.path.join(path, "image" + str(i))
        with open(file, "r") as f:
            data = [float(pixel) for pixel in f.readlines()[0].split(",")[:-1]]
            images[idx, :, :] = 
np.array(data)