d5a75ba09ae0595ca284fd806475eb8d3f771387,word_language_model/generate.py,,,#,18
Before Change
for i in range(args.nwords):
output, hidden = model(Variable(input, volatile=True), hidden)
gen = torch .multinomial(output[0].data.div(temperature).exp().cpu(), 1)[0][0] // FIXME: multinomial is only for CPU
input.fill_(gen)
word = corpus.dic.idx2word[gen]
outf.write(word)
After Change
else:
torch.cuda.manual_seed(args.seed)
if args.temperature < 1e-3:
parser.error("--temperature has to be greater or equal 1e-3")
with open(args.checkpoint, "rb") as f:
model = torch.load(f)
if args.cuda:
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 3
Instances Project Name: OpenNMT/OpenNMT-py
Commit Name: d5a75ba09ae0595ca284fd806475eb8d3f771387
Time: 2017-01-17
Author: adam.paszke@gmail.com
File Name: word_language_model/generate.py
Class Name:
Method Name:
Project Name: cornellius-gp/gpytorch
Commit Name: a78d17ccb29c93a413daf98565af7eeedf45e6c9
Time: 2018-01-10
Author: gpleiss@gmail.com
File Name: gpytorch/random_variables/categorical_random_variable.py
Class Name: CategoricalRandomVariable
Method Name: sample