import torch


def make_optimizer(generator, learning_rate):
  """Make optimizer for generator's parameters.
  Args:
    generator: generator model
    learning_rate: learning rate
    input_learing_rate: learning rate for input
  Returns:
    optimizer
  """

  my_list = ['positions_top']
  params = list(map(lambda x: x[1],list(filter(lambda kv: kv[0] in my_list,
                                               generator.named_parameters()))))
  base_params = list(map(lambda x: x[1],list(filter(lambda kv: kv[0] not in
                                      my_list, generator.named_parameters()))))
  lr_scheduler = torch.optim.SGD([{'params': base_params},
                                  {'params': params, 'lr': learning_rate}],
                                    lr=learning_rate)
  return lr_scheduler