import torch


def add_gaussian_noise(tensor, mean=0.1, std=1., device='cpu'):
  """Function that add noise to a given tensor.

  Args:
    tensor: An input tensor
    mean: Gaussian noise mean
    std: Gaussian noise std
    device: device used to store tensor

  Returns:
    tensor: A new tensor with added noise

  """

  return tensor + torch.randn(tensor.size()).to(device) * std + mean