Skip to content

Commit

Permalink
fix assertion 't >= 0 && t < n_classes' error in a very naive way. Ne…
Browse files Browse the repository at this point in the history
…ed to find out the actual cause
  • Loading branch information
yoyolicoris committed May 27, 2019
1 parent ee0f273 commit 3591786
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions data_loader/data_loaders.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ def __getitem__(self, index):
x = np.clip(x, -1, 1)
x = self.f2c(self.mulaw(x))

# fix possible outlier
x = np.clip(x, 0, self.q_channels - 1)
t = np.clip(t, 0, self.q_channels - 1)

f = interp1d(self.hop_idx[:condition.shape[1]], condition, copy=False, axis=1)
h = f(np.arange(pos + 1, pos + 1 + self.segment))

Expand All @@ -77,3 +81,13 @@ def __init__(self, steps, data_dir, batch_size, num_workers, **kwargs):
self.data_dir = data_dir
self.dataset = _WAVDataset(data_dir, batch_size * steps, **kwargs)
super().__init__(self.dataset, batch_size, num_workers=num_workers)


if __name__ == '__main__':
mulaw = np_mulaw(256)
f2c = float2class(256)

import numpy as np

x = np.random.randn(10000)
print(f2c(mulaw(x)).max(), f2c(mulaw(x)).min())

0 comments on commit 3591786

Please sign in to comment.