code: def evaluate(loader):
      step = 0
      results = []
      for batch in loader:
          step += 1
          inputs, target = batch
          predictions = model(inputs, training=False)
          loss = loss_fn(target, predictions)
          acc = tf.reduce_mean(
              categorical_accuracy(target, predictions)
          )
          results.append(
              (loss, acc, len(target))
          )  # Keep track of batch size
          if step == loader.steps_per_epoch:
              results = np.array(results)
              return np.average(
                  results[:, :-1], 0, weights=results[:, -1]
              )
  
file_path: spektral/examples/other/explain_graph_predictions.py
imports: import matplotlib.pyplot
  import numpy
  import tensorflow
  from tensorflow.keras.losses import CategoricalCrossentropy
  from tensorflow.keras.metrics import categorical_accuracy
  from tensorflow.keras.optimizers import Adam
  from spektral.data import DisjointLoader
  from spektral.datasets import TUDataset
  from spektral.models import GeneralGNN, GNNExplainer
label_desc: Use image node_id 2 for calling a global function with example usage: evaluate(loader) and returns: np