Skip to content

Instantly share code, notes, and snippets.

@0xfe
Created March 2, 2020 16:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 0xfe/0da873c4ee32ff1bbb5d22b9f0b49817 to your computer and use it in GitHub Desktop.
Save 0xfe/0da873c4ee32ff1bbb5d22b9f0b49817 to your computer and use it in GitHub Desktop.
Generate training data for spectrogram
def build_training_data(batch_size, sample_size):
xs = np.random.randn(batch_size, sample_size)
f, t, ys = spectrogram(xs)
(num_rows, num_cols) = (ys.shape[1], ys.shape[2])
print(ys.shape)
ys = ys.reshape(batch_size, num_rows * num_cols)
Ys = np.hstack([ys.real, ys.imag])
return (xs, Ys, num_rows, num_cols)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment