code: def get_optimizer(name, parameters, lr):
      if name == "sgd":
          return torch.optim.SGD(parameters, lr=lr)
      elif name == "adagrad":
          return torch.optim.Adagrad(parameters, lr=lr)
      elif name == "adam":
          return torch.optim.Adam(parameters)  # use default lr
      elif name == "adamax":
          return torch.optim.Adamax(parameters)  # use default lr
      else:
          raise Exception("Unsupported optimizer: {}".format(name))
  
file_path: stanza/stanza/models/common/seq2seq_utils.py
imports: from collections import Counter
  import random
  import json
  import torch
  import stanza.models.common.seq2seq_constant
label_desc: Use image node_id 1 for calling a global function with example usage: get_optimizer(name, parameters, lr) and returns: torch, torch, torch, torch