import tensorflow as tf

  if params['optimizer'] == 'momentum':
    optimizer = tf.train.MomentumOptimizer(
        learning_rate, momentum=params['momentum'])
  elif params['optimizer'] == 'adam':
    optimizer = tf.train.AdamOptimizer(learning_rate)
  elif params['optimizer'] == 'adadelta':
    optimizer = tf.train.AdadeltaOptimizer(learning_rate)
  elif params['optimizer'] == 'adagrad':
    optimizer = tf.train.AdagradOptimizer(learning_rate)
  elif params['optimizer'] == 'rmsprop':
    optimizer = tf.train.RMSPropOptimizer(
        learning_rate, momentum=params['momentum'])
  elif params['optimizer'] == 'lars':
    optimizer = tf.contrib.opt.LARSOptimizer(
        learning_rate,
        momentum=params['momentum'],
        weight_decay=params['lars_weight_decay'],
        skip_list=['batch_normalization', 'bias'])
  else:
    raise ValueError('Unsupported optimizer type %s.' % params['optimizer'])
  return optimizer


def remove_variables(variables, resnet_depth=50):
  """Removes low-level variables from the input.

