Ensure returns from noise are always Tensors
This commit is contained in:
parent
dcde2150ac
commit
bf22f42cb3
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user