a7cd7a15a9baf741f2b4fcd32f3d8055827889b5,examples/word_language_model/predict.py,,,#,11
Before Change
learner.initialize()
if not args.cuda:
learner.module_ = torch.load(args.checkpoint, map_location=lambda storage, location: "cpu")
else:
learner.module_ = torch.load(args.checkpoint)
hidden = learner.module_.init_hidden(1)
input = Variable(torch.rand(1, 1).mul(ntokens).long(), volatile=True)
if args.cuda:
input = input.cuda()
p = learner.predict_proba(np.array([[
corpus.dictionary.word2idx["fish"],
corpus.dictionary.word2idx["sees"],
corpus.dictionary.word2idx["man"],
After Change
words = [corpus.dictionary.idx2word[n] for n in range(10)]
print(words)
p = learner.predict_proba(np.array([[
corpus.dictionary.word2idx["fish"],
corpus.dictionary.word2idx["sees"],
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 6
Instances Project Name: dnouri/skorch
Commit Name: a7cd7a15a9baf741f2b4fcd32f3d8055827889b5
Time: 2017-08-08
Author: marian.tietz@ottogroup.com
File Name: examples/word_language_model/predict.py
Class Name:
Method Name:
Project Name: rusty1s/pytorch_geometric
Commit Name: b44364811b14bde01d84554624a9bffa0e4976e3
Time: 2018-03-07
Author: matthias.fey@tu-dortmund.de
File Name: examples/cora_gcn.py
Class Name:
Method Name:
Project Name: mozilla/TTS
Commit Name: e02fc51fde25ad2a66f630f79a5d6b8a8c9fedc7
Time: 2019-08-23
Author: egolge@mozilla.com
File Name: server/synthesizer.py
Class Name: Synthesizer
Method Name: tts