code: def train_loop(meta_tasks):
      """
      Metalearning training loop. Trained for 100 epochs in original experiment.
  
      :param meta_tasks: list of metatasks.
      :param num_iter: number of iterations of tasks set
      :returns: a mean function object
      """
      # Initialize mean function
      mean_function = build_mean_function()
      # Iterate for several passes over the tasks set
      for iteration in range(num_iter):
          ts = time.time()
          print(
              "Currently in meta-iteration/epoch {}".format(iteration)
          )
          # Iterate over tasks
          for i, task in enumerate(meta_tasks):
              data = task  # (X, Y)
              model = build_model(data, mean_function=mean_function)
              run_adam(model, reduce_in_tests(100))
  
          print(">>>> iteration took {:.2f} s".format(time.time() - ts))
      return mean_function
  
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 7 for calling a global function with example usage: train_loop(meta_tasks) and returns: mean_function