import torch


def numpy_img_to_torch(batch):
    """Preprocess images
    
    Process numpy images:
    1. Normalize by dividing by 255.0
    2. Set datatype to be float32
    3. Make sure the input dimensions are (batch size, channels, height, width)
    4. Convert to torch.Tensor type
    
    Returns
    -------
    torch.Tensor
        Processed images ready to be fed as input to Conv2D
    """
    
    return torch.from_numpy((batch/255.0).astype('float32'))\
                .permute(0, 3, 1, 2)