7bc27fac82840ceb07b1afc76254b46840efedfe,tests/layers_tests.py,L1LossMaskedTests,test_in_out,#L1LossMaskedTests#,63
Before Change
layer = L1LossMasked()
dummy_input = T.autograd.Variable(T.ones(4, 8, 128).float())
dummy_target = T.autograd.Variable(T.ones(4, 8, 128).float())
dummy_length = T.autograd.Variable((T.ones(4) * 8).long())
output = layer(dummy_input, dummy_target, dummy_length)
assert output.shape[0] == 0
assert len(output.shape) == 1
assert output.data[0] == 0.0
dummy_input = T.autograd.Variable(T.ones(4, 8, 128).float())
dummy_target = T.autograd.Variable(T.zeros(4, 8, 128).float())
dummy_length = T.autograd.Variable((T.ones(4) * 8).long())
output = layer(dummy_input, dummy_target, dummy_length)
assert output.data[0] == 1.0, "1.0 vs {}".format(output.data[0])
dummy_input = T.autograd.Variable(T.ones(4, 8, 128).float())
dummy_target = T.autograd.Variable(T.zeros(4, 8, 128).float())
dummy_length = T.autograd.Variable((T.arange(5, 9)).long())
mask = ((_sequence_mask(dummy_length).float() - 1.0)
* 100.0).unsqueeze(2)
output = layer(dummy_input + mask, dummy_target, dummy_length)
After Change
layer = L1LossMasked()
dummy_input = T.ones(4, 8, 128).float()
dummy_target = T.ones(4, 8, 128).float()
dummy_length = (T.ones(4) * 8).long()
output = layer(dummy_input, dummy_target, dummy_length)
assert output.item() == 0.0
dummy_input = T.ones(4, 8, 128).float()
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 6
Instances
Project Name: mozilla/TTS
Commit Name: 7bc27fac82840ceb07b1afc76254b46840efedfe
Time: 2018-04-25
Author: egolge@mozilla.com
File Name: tests/layers_tests.py
Class Name: L1LossMaskedTests
Method Name: test_in_out
Project Name: mozilla/TTS
Commit Name: 7bc27fac82840ceb07b1afc76254b46840efedfe
Time: 2018-04-25
Author: egolge@mozilla.com
File Name: tests/layers_tests.py
Class Name: L1LossMaskedTests
Method Name: test_in_out
Project Name: PetrochukM/PyTorch-NLP
Commit Name: 7b05db6f551e7260f76ff456c25c05de07882650
Time: 2018-05-05
Author: petrochukm@gmail.com
File Name: examples/awd-lstm-lm/splitcross.py
Class Name:
Method Name:
Project Name: mozilla/TTS
Commit Name: 14c9e9cde997e83a68f4852423d416f95f3cf513
Time: 2018-05-10
Author: egolge@mozilla.com
File Name: tests/layers_tests.py
Class Name: L1LossMaskedTests
Method Name: test_in_out