Hisrar:

dec_hidden


the attribute repeat is available to Tensor but the variable dec_hidden is of type Tuple. Make sure to convert your tuple to a Tensor and then it’ll work. If it’s a Tuple of 1 object do,
dec_hidden[0].repeat(1, beam_size, 1)