spoter-demo-test / spoter /gaussian_noise.py
Matyáš Boháček
Initial commit
ccdf9bb
raw
history blame
395 Bytes
import torch
class GaussianNoise(object):
def __init__(self, mean=0., std=1.):
self.std = std
self.mean = mean
def __call__(self, tensor):
return tensor + torch.randn(tensor.size()) * self.std + self.mean
def __repr__(self):
return self.__class__.__name__ + '(mean={0}, std={1})'.format(self.mean, self.std)
if __name__ == "__main__":
pass