b25cc3a7e6a560c1fd47f36a43296f62eaaace36,transformer/Translator.py,Translator,__init__,#Translator#,13
Before Change
def __init__(self, opt):
self.opt = opt
self.device = torch.device("cuda" if opt.cuda else "cpu")
checkpoint = torch.load(opt.model)
model_opt = checkpoint["settings"]
After Change
self.register_buffer("init_seq", torch.LongTensor([[trg_bos_idx]]))
self.register_buffer(
"blank_seqs",
torch.full((beam_size, max_seq_len), trg_pad_idx, dtype=torch.long))
self.blank_seqs[:, 0] = self.trg_bos_idx
self.register_buffer(
"len_map",
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 3
Instances
Project Name: jadore801120/attention-is-all-you-need-pytorch
Commit Name: b25cc3a7e6a560c1fd47f36a43296f62eaaace36
Time: 2019-12-07
Author: jadore801120@gmail.com
File Name: transformer/Translator.py
Class Name: Translator
Method Name: __init__
Project Name: jadore801120/attention-is-all-you-need-pytorch
Commit Name: ac16b752e6f3698c2c6ba4c4f581d490526519ef
Time: 2018-08-25
Author: yhhuang@nlg.csie.ntu.edu.tw
File Name: transformer/Beam.py
Class Name: Beam
Method Name: __init__
Project Name: openai/gym
Commit Name: cee92691ad858952b4ed46c08cad6cc682868d22
Time: 2019-03-24
Author: zuoxingdong@users.noreply.github.com
File Name: gym/spaces/box.py
Class Name: Box
Method Name: __init__