import torch


def encode_img(img):
    """
    Encodes a numpy array into a torch Tensor and permutes channels
    :param img: (batch, batch, width, height, channels)) the numpy array
    representing an image
    :return: (batch, batch, channels width, height) a torch Tensor
    """
    img_torch = torch.Tensor(img)
    img_torch = img_torch.permute(0, 1, 4, 2, 3)
    # infer initial model state
    return img_torch