Hi guys,
Regarding two optimizers and two losses:
I need to train two networks to learn the coordinates (translation + rotations). Would this work?
…
optimizer_Trans = optim.Adam(parameters_Trans_to_train, lr)
model_lr_scheduler_Trans = optim.lr_scheduler.StepLR(
optimizer_Trans, scheduler_step_size, 0.1)
optimizer_Rotat = optim.Adam(parameters_Rotat_to_train, lr)
model_lr_scheduler_Rotat = optim.lr_scheduler.StepLR(
optimizer_Rotat, scheduler_step_size, 0.1)
…
model_lr_scheduler_Trans.step()
model_lr_scheduler_Rotat.step()
for batch_idx, inputs in enumerate(train_loader):
loss_Trans, loss_Rotat = process_batch(inputs)

optimizer_Trans.zero_grad()
loss_Trans.backward(retain_graph=True)
optimizer_Trans.step()

optimizer_Rotat.zero_grad()
loss_Rotat.backward(retain_graph=True)
optimizer_Rotat.step()