2021-09-10 17:28:58 +00:00
|
|
|
import unittest
|
|
|
|
|
2020-07-17 09:36:36 +00:00
|
|
|
import numpy as np
|
|
|
|
import tensorflow as tf
|
2021-09-10 17:28:58 +00:00
|
|
|
import torch
|
2020-07-17 09:36:36 +00:00
|
|
|
|
2020-09-09 10:27:23 +00:00
|
|
|
from TTS.vocoder.tf.models.melgan_generator import MelganGenerator
|
2020-07-17 09:36:36 +00:00
|
|
|
|
2021-09-10 17:28:58 +00:00
|
|
|
use_cuda = torch.cuda.is_available()
|
|
|
|
|
2020-07-28 12:53:56 +00:00
|
|
|
|
2021-09-10 17:28:58 +00:00
|
|
|
@unittest.skipIf(use_cuda, " [!] Skip Test: Loosy TF support.")
|
2020-07-17 09:36:36 +00:00
|
|
|
def test_melgan_generator():
|
|
|
|
hop_length = 256
|
|
|
|
model = MelganGenerator()
|
2020-07-28 12:53:56 +00:00
|
|
|
# pylint: disable=no-value-for-parameter
|
2020-07-17 09:36:36 +00:00
|
|
|
dummy_input = tf.random.uniform((4, 80, 64))
|
|
|
|
output = model(dummy_input, training=False)
|
|
|
|
assert np.all(output.shape == (4, 1, 64 * hop_length)), output.shape
|