import torch


def denormalize(tensor, mean, std):
    """
    Apply denormalization on input tensor. 
    denormalized_tensor = input_tensor * Std.Dev + Mean

    Args:
        tensor (tensor): Input normalized tensor on which denormalization is to be applied. Tensor must be 4d.
        mean (tuple) : 
        std (tuple) : 
    
    Returns:
        denormalized tensor : Denormalized tensor.

    """
    if not tensor.ndimension() == 4:
        raise TypeError('tensor should be 4D')
    mean = torch.FloatTensor(mean).view(1, 3, 1, 1).expand_as(tensor).to(tensor.device)
    std = torch.FloatTensor(std).view(1, 3, 1, 1).expand_as(tensor).to(tensor.device)
    return tensor.mul(std).add(mean)