I am doing an assignment on Neural Machine Translation and training an LSTM specifically . During Decoding stage I got this Error " AttributeError: ‘tuple’ object has no attribute ‘repeat’ ". I am unable to understand what the error (that I am getting) is, and how I can solve it?
Traceback (most recent call last):
File “train.py”, line 618, in 
early_stopping=early_stopping)
File “train.py”, line 186, in train_epochs
decode(model, dataset, epoch)
File “/home/hisrar/NMT/kg_model.py”, line 357, in beam_decode
dec_hidden.repeat(1, batch_size * beam_size, 1)
AttributeError: ‘tuple’ object has no attribute ‘repeat’
Part of the program where I get the Error is
    batch_size, beam_size = self.config.batch_size, self.config.beam_size

    # [1, batch_size x beam_size]

    dec_input = torch.ones(1, batch_size * beam_size,
                           dtype=torch.long,
                           device=self.device) * SOS_ID

   #[num_layers, batch_size * beam_size, hidden_size]

    #dec_hidden = dec_hidden.repeat(1, beam_size,1)
  
    if enc_outputs is not None:
        enc_outputs = enc_outputs.repeat(1, beam_size, 1)
        enc_length = enc_length.repeat(beam_size)


screenshot955×689 48.8 KB