import torch


def undo_imagenet_preprocess(image):
    """ Undo imagenet preprocessing
    Input:
    - image (pytorch tensor): image after imagenet preprocessing in CPU, shape = (3, 224, 224)
    Output:
    - undo_image (pytorch tensor): pixel values in [0, 1]
    """
    mean = torch.Tensor([0.485, 0.456, 0.406]).view((3, 1, 1))
    std = torch.Tensor([0.229, 0.224, 0.225]).view((3, 1, 1))
    undo_image = image * std
    undo_image += mean
    return undo_image