code: def evaluate_metrics(inputs, sess, dataset, metrics):
      import tensorflow as tf
  
      if dataset.batch_per_thread > 0:
          batch_size = (
              dataset.batch_per_thread * dataset.get_num_partitions()
          )
      else:
          batch_size = dataset.batch_size
  
      real_batch_size = tf.shape(inputs[0])[0]
  
      outputs, eval_methods = TFModel._process_metrics(
          inputs[0].graph,
          metrics=metrics,
          real_batch_size=real_batch_size,
      )
  
      tfnet = TFNet.from_session(sess, inputs=inputs, outputs=outputs)
  
      results = tfnet.evaluate(dataset, batch_size, eval_methods)
      final_result = dict([(r.method, r.result) for r in results])
      return final_result
  
imports: from bigdl.orca.tfpark.tfnet import TFNet
  from bigdl.orca.tfpark.tf_optimizer import BigDLMetric, TFModel
  from bigdl.dllib.keras import metrics
  from bigdl.dllib.utils.log4Error import *
label_desc: Use image node_id 3 for calling a global function with example usage: evaluate_metrics(inputs, sess, dataset, metrics) and returns: final_result