import torch


def tensor_to_image(tensor):
    """
    transforms a tensor to an image
    Args:
        tensor: tensor of size (1, 3, x, y)
    Returns: tensor of size(x, y, 3)
    """
    x, y = tensor.size()[-2:]
    a, b, c = tensor[0]
    return torch.cat(
        (a.reshape(x, y, 1), b.reshape(x, y, 1), c.reshape(x, y, 1)), 2)