Commit 8153fe20 authored by Jean Ibarz's avatar Jean Ibarz
Browse files

Added a test for Gammatone filter layer.

parent 74b6cb12
......@@ -108,3 +108,22 @@ def test_gtf_layer():
# plt.plot(np_r[0, :, 10], 'b')
# plt.plot(np_r[0, :, -1], 'g')
# plt.show()
def test_gtf_layer2():
import tensorflow as tf
from core.utils import get_gtf_kernels
kernels = get_gtf_kernels(gtf_dirpath='../gtf')
assert kernels.shape == (512, 20)
from core.layers import GtfLayer
gtf_layer = GtfLayer(kernels=kernels)
x = np.zeros(shape=(1, 512 * 2, 2, 1))
x[:, 511, :, 0] = 1
x_left = gtf_layer(x[:, :, 0, :])
x_right = gtf_layer(x[:, :, 1, :])
x_band = tf.stack([x_left, x_right], axis=-2)
np_r = x_band.numpy()
print('b')
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment