Transformers, Pytorch, Machine Learning, Deep Dives, Data Science.
torch.tensor([EOS_IDX])]).unsqueeze(0) encoder_output, mask = self.transformer.encode(x) # (B, S, E) if not max_length: max_length = x.size(1) outputs = torch.ones((x.size()[0], max_length)).type_as(x).long() * SOS_IDX for step in range(1, max_length): y = outputs[:, :step] probs =