From bf22f42cb31da9613b126b61ec3c88367a904f30 Mon Sep 17 00:00:00 2001 From: Dominik Roth Date: Sun, 21 May 2023 20:28:52 +0200 Subject: [PATCH] Ensure returns from noise are always Tensors --- priorConditionedAnnealing/noise.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/priorConditionedAnnealing/noise.py b/priorConditionedAnnealing/noise.py index dadf7a7..224dbd2 100644 --- a/priorConditionedAnnealing/noise.py +++ b/priorConditionedAnnealing/noise.py @@ -15,10 +15,10 @@ class Colored_Noise(): self.reset(random_state=random_state) def __call__(self, shape, latent: th.Tensor = None) -> th.Tensor: - assert shape == self.knonw_shape + assert shape == self.known_shape sample = self.samples[:, self.index] self.index = (self.index+1) % self.num_samples - return sample + return th.Tensor(sample) def reset(self, random_state=None): self.samples = cn.powerlaw_psd_gaussian( @@ -100,8 +100,9 @@ class Perlin_Noise(): def __call__(self, shape): self.index += 1 - return [self.noise([self.index*self.scale, self.magic*(a+1)]) / self.normal_factor - for a in range(self.known_shape[-1])] + noise = [self.noise([self.index*self.scale, self.magic*(a+1)]) / self.normal_factor + for a in range(self.known_shape[-1])] + return th.Tensor(noise) def reset(self): self.index = 0