positions = Variable(
input.data.new(1, 1).fill_(self.padding_idx + input.size(1)))
else:
positions = Variable(self.make_positions(input.data))
return super().forward(positions)
def max_positions(self):
Maximum number of supported positions.
After Change
// positions is the same for every token when decoding a single step
positions = input.data.new(1, 1).fill_(self.padding_idx + input.size(1))
else:
positions = utils.make_positions(input.data, self.padding_idx, self.left_pad)
return super().forward(Variable(positions))
def max_positions(self):
Maximum number of supported positions.