I am continuously getting this error in "train_first.py", line 331, in main
g_loss.requires_grad = True
RuntimeError: you can only change requires_grad flags of leaf variables.
if epoch >= TMA_epoch: # start TMA training
loss_s2s = 0
for _s2s_pred, _text_input, _text_length in zip(s2s_pred, texts, input_lengths):
loss_s2s += F.cross_entropy(_s2s_pred[:_text_length], _text_input[:_text_length])
loss_s2s /= texts.size(0)
I am continuously getting this error in "train_first.py", line 331, in main g_loss.requires_grad = True RuntimeError: you can only change requires_grad flags of leaf variables.
if epoch >= TMA_epoch: # start TMA training loss_s2s = 0 for _s2s_pred, _text_input, _text_length in zip(s2s_pred, texts, input_lengths): loss_s2s += F.cross_entropy(_s2s_pred[:_text_length], _text_input[:_text_length]) loss_s2s /= texts.size(0)