code: def evaluate(
      data_provider,
      model,
      evaluator_classes,
      save_dir="/tmp/ddsp/training",
      restore_dir="",
      batch_size=32,
      num_batches=50,
      repeats=-1,
      ckpt_delay_secs=0,
      run_once=False,
      run_until_step=0,
      evaluate_and_sample=False,
  ):
      """Run evaluation loop.
  
      Args:
        data_provider: DataProvider instance.
        model: Model instance.
        evaluator_classes: List of BaseEvaluators subclasses (not instances).
        save_dir: Path to directory to save summary events.
        restore_dir: Path to directory with checkpoints, defaults to save_dir.
        batch_size: Size of each eval/sample batch.
        num_batches: How many batches to eval from dataset. -1 denotes all batches.
        repeats: Number of repeats through dataset. -1 means repeat infinitely.
        ckpt_delay_secs: Time to wait when a new checkpoint was not detected.
        run_once: Only run evaluation or sampling once.
        run_until_step: Run until we see a checkpoint with a step greater or equal
          to the specified value. Ignored if <= 0.
        evaluate_and_sample: Run both evaluate() and sample() on the batches.
  
      Returns:
        A dictionary of tensors containing the loss values, keyed by loss type.
  
      """
      return evaluate_or_sample(
          data_provider=data_provider,
          model=model,
          evaluator_classes=evaluator_classes,
          mode="eval",
          save_dir=save_dir,
          restore_dir=restore_dir,
          batch_size=batch_size,
          repeats=repeats,
          num_batches=num_batches,
          ckpt_delay_secs=ckpt_delay_secs,
          run_once=run_once,
          run_until_step=run_until_step,
          evaluate_and_sample=evaluate_and_sample,
      )
  
file_path: ddsp/ddsp/training/eval_util.py
imports: import os
  import time
  from absl import logging
  import ddsp
  from ddsp.training import data
  import gin
  import tensorflow.compat.v2
label_desc: Use image node_id 2 for calling a global function with example usage: evaluate(data_provider, model, evaluator_classes, save_dir, restore_dir, batch_size, num_batches, repeats, ckpt_delay_secs, run_once, run_until_step, evaluate_and_sample) and returns: evaluate_or_sample