I used the following SGD as the optimizers for encoder and decoder:
encoder_optimizer = optim.SGD(encoder.parameters(), lr=learning_rate, momentum=.9)
decoder_optimizer = optim.SGD(decoder.parameters(), lr=learning_rate, momentum=.9)
I used the NLLLose as the loss function:
criterion = nn.NLLLoss()
Then the process of training is begining:
for epoch …:
for eachsample …:
loss = train(source, target, encoder, decoder, encoder_optimizer, decoder_optimizer, criterion)