Is it right to define optimizer at every epoch for varying learning rate and momentum?
lr_arr=np.linspace(0.03, 0.0001, epochs)
momentum_arr=np.linspace(0.9, 0.999, epochs)
for epoch in range(1, epochs + 1):
        optimizer = torch.optim.SGD(model_two.parameters(),lr=lr_arr[epoch-1], momentum=momentum_arr[epoch-1], nesterov=True)
        train_loss_net2.append(train( model_two, device, train_loader, optimizer,criterion,epoch))
        test_loss_net2.append(test(model_two, device,criterion,test_loader))
end = datetime.datetime.now()
print(end-start)