If I write this code ,it will occur that error
optimizer.zero_grad()
loss.backward()
loss.backward()
optimizer.step()
I think ,it use the last time  loss to backpropagation ,so this state happen.but I writed the code is this:
loss=criterion(out,target_out)
optimizer_en.zero_grad()
optimizer_de.zero_grad()
print(‘loss %.4f’%(loss))
loss.backward()
optimizer_en.step()
optimizer_de.step()