Set seed before generating random tensors in NMT test (#2206)

* Change label smoothing prob to reduce chance of test failure

Signed-off-by: MaximumEntropy <sandeep.subramanian.1@umontreal.ca>

* Set seed before generating tensors

Signed-off-by: MaximumEntropy <sandeep.subramanian.1@umontreal.ca>
This commit is contained in:
Sandeep Subramanian 2021-05-13 16:23:48 -06:00 committed by GitHub
parent 52a36fb92e
commit d1540e8bff
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -95,6 +95,7 @@ class TestMTEncDecModel:
batch_size = 10
time = 32
vocab_size = 32000
torch.manual_seed(42)
tgt_ids = torch.LongTensor(batch_size, time).random_(1, model.decoder_tokenizer.vocab_size)
logits = torch.FloatTensor(batch_size, time, vocab_size).random_(-1, 1)
log_probs = torch.nn.functional.log_softmax(logits, dim=-1)