code: def train_fn(loss, learning_rate, learner):
      if learner.lower() == "adagrad":
          opt = tf.train.AdagradOptimizer(
              learning_rate=learning_rate, name="optimizer"
          )
      elif learner.lower() == "rmsprop":
          opt = tf.train.RMSPropOptimizer(
              learning_rate=learning_rate, name="optimizer"
          )
      elif learner.lower() == "adam":
          opt = tf.train.AdamOptimizer(
              learning_rate=learning_rate, name="optimizer"
          )
      else:
          opt = tf.train.GradientDescentOptimizer(
              learning_rate=learning_rate, name="optimizer"
          )
  
      return opt.minimize(loss)
  
imports: import warnings
  import tensorflow.compat.v1
label_desc: Use image node_id 2 for calling a global function with example usage: train_fn(loss, learning_rate, learner) and returns: opt