code: def run_adam(model, iterations):
      """
      Utility function running the Adam optimizer
  
      :param model: GPflow model
      :param interations: number of iterations
      """
      # Create an Adam Optimizer action
      logf = []
      adam = tf.optimizers.Adam()
      optimization_step = create_optimization_step(adam, model)
      for step in range(iterations):
          loss = optimization_step()
          if step % 10 == 0:
              # print("num variables", len(model.trainable_variables))
              logf.append(loss.numpy())
      return logf
  
file_path: GPflow/notebooks/tailor/external-mean-function.pct.py
imports: import matplotlib.pyplot
  import numpy
  import tensorflow
  import gpflow
  from gpflow.ci_utils import reduce_in_tests
  from gpflow.kernels import RBF
  from gpflow.models import GPR
  from gpflow.config import default_float
  from gpflow import set_trainable
  import time
label_desc: Use image node_id 6 for calling a global function with example usage: run_adam(model, iterations) and returns: logf