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:
parent
52a36fb92e
commit
d1540e8bff
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue