from torch import optim
from functools import partial


def get_optimizer(optimizer):
	"""
	Returns an optimizer according to the passed string.
	:param optimizer: The string representation of the optimizer. eg. 'adam' for Adam etc.
	:return: The proper nn.optim optimizer.
	"""

	_optim_dict = {'adam': partial(optim.Adam, amsgrad=True)}
	return _optim_dict[optimizer]