import torch


def torch_reset_optim(new_lr, lstm, optimizer):
    """Reinitialize Pytorch optimizer with different learning rate"""
    return getattr(torch.optim, optimizer)(lstm.parameters(), lr=new_lr)