(self, x, eps=0.00001)
| 258 | # normalization, pointwise gaussian |
| 259 | class UnitGaussianNormalizer(object): |
| 260 | def __init__(self, x, eps=0.00001): |
| 261 | super(UnitGaussianNormalizer, self).__init__() |
| 262 | |
| 263 | # x could be in shape of ntrain*n or ntrain*T*n or ntrain*n*T |
| 264 | self.mean = torch.mean(x, 0) |
| 265 | self.std = torch.std(x, 0) |
| 266 | self.eps = eps |
| 267 | |
| 268 | def encode(self, x): |
| 269 | x = (x - self.mean) / (self.std + self.eps) |