def _init_buffers(self, t):
if self.scores_buf is None:
self.scores_buf = t.new()
self.indices_buf = torch.LongTensor().to(device=t.device)
self.beams_buf = torch.LongTensor().to(device=t.device)
def step(self, step, lprobs, scores):
Take a single search step.
After Change
if not self.scores_buf.size()[0]:
self.scores_buf = torch.empty(0).to(t)
self.indices_buf = torch.empty(0).to(t).long()
self.beams_buf = torch.empty(0).to(t).long()
def step(self, step, lprobs, scores):
Take a single search step.