masked loss

This commit is contained in:
Eren Golge
2018-03-22 13:46:52 -07:00
parent 0f3b2ddd7b
commit 33937f54d0
4 changed files with 39 additions and 24 deletions
+1 -5
View File
@@ -37,16 +37,12 @@ class DecoderTests(unittest.TestCase):
dummy_memory = T.autograd.Variable(T.rand(4, 120, 32))
print(layer)
output, alignment, stop_output = layer(dummy_input, dummy_memory)
output, alignment = layer(dummy_input, dummy_memory)
print(output.shape)
print(" > Stop ", stop_output.shape)
assert output.shape[0] == 4
assert output.shape[1] == 120 / 5
assert output.shape[2] == 32 * 5
assert stop_output.shape[0] == 4
assert stop_output.shape[1] == 120 / 5
assert stop_output.shape[2] == 5
class EncoderTests(unittest.TestCase):
+11 -5
View File
@@ -43,9 +43,10 @@ class TestDataset(unittest.TestCase):
text_lengths = data[1]
linear_input = data[2]
mel_input = data[3]
stop_targets = data[4]
item_idx = data[5]
mel_lengths = data[4]
stop_target = data[5]
item_idx = data[6]
neg_values = text_input[text_input < 0]
check_count = len(neg_values)
assert check_count == 0, \
@@ -82,8 +83,9 @@ class TestDataset(unittest.TestCase):
text_lengths = data[1]
linear_input = data[2]
mel_input = data[3]
stop_target = data[4]
item_idx = data[5]
mel_lengths = data[4]
stop_target = data[5]
item_idx = data[6]
# check the last time step to be zero padded
assert mel_input[0, -1].sum() == 0
@@ -92,6 +94,10 @@ class TestDataset(unittest.TestCase):
assert linear_input[0, -2].sum() != 0
assert stop_target[0, -1] == 1
assert stop_target.sum() == 1
assert len(mel_lengths.shape) == 1
print(mel_lengths)
print(mel_input)
assert mel_lengths[0] == mel_input[0].shape[0]