code: def main(data_num):
      data_path = "/tmp/mnist" if not args.data_path else args.data_path
      cluster_mode = args.cluster_mode
      if cluster_mode.startswith("yarn"):
          hadoop_conf = os.environ.get("HADOOP_CONF_DIR")
          invalidInputError(
              hadoop_conf is not None,
              "Directory path to hadoop conf not found for yarn-client mode. Please "
              "set the environment variable HADOOP_CONF_DIR",
          )
          spark_conf = (
              create_spark_conf()
              .set("spark.executor.memory", "5g")
              .set("spark.executor.cores", 2)
              .set("spark.executor.instances", 2)
              .set(
                  "spark.executorEnv.HTTP_PROXY",
                  "http://child-prc.intel.com:913",
              )
              .set(
                  "spark.executorEnv.HTTPS_PROXY",
                  "http://child-prc.intel.com:913",
              )
              .set("spark.driver.memory", "2g")
          )
          if cluster_mode == "yarn-client":
              sc = init_nncontext(
                  spark_conf,
                  cluster_mode="yarn-client",
                  hadoop_conf=hadoop_conf,
              )
          else:
              sc = init_nncontext(
                  spark_conf,
                  cluster_mode="yarn-cluster",
                  hadoop_conf=hadoop_conf,
              )
      else:
          sc = init_nncontext()
  
      # get data, pre-process and create TFDataset
      (images_data, labels_data) = mnist.read_data_sets(
          data_path, "test"
      )
      images_data = (
          images_data[:data_num] - mnist.TRAIN_MEAN
      ) / mnist.TRAIN_STD
      labels_data = labels_data[:data_num].astype(np.int32)
      dataset = TFDataset.from_ndarrays(
          (images_data, labels_data), batch_per_thread=20
      )
  
      # construct the model from TFDataset
      images, labels = dataset.tensors
  
      labels = tf.squeeze(labels)
  
      with slim.arg_scope(lenet.lenet_arg_scope()):
          logits, end_points = lenet.lenet(
              images, num_classes=10, is_training=False
          )
  
      predictions = tf.to_int32(tf.argmax(logits, axis=1))
      correct = tf.expand_dims(
          tf.to_int32(tf.equal(predictions, labels)), axis=1
      )
  
      saver = tf.train.Saver()
  
      with tf.Session() as sess:
          sess.run(tf.global_variables_initializer())
          saver.restore(sess, "/tmp/lenet/model")
  
          predictor = TFPredictor(sess, [correct])
  
          accuracy = predictor.predict().mean()
  
          print("predict accuracy is %s" % accuracy)
  
file_path: BigDL/python/orca/example/tfpark/tf_optimizer/evaluate.py
imports: import argparse
  import tensorflow
  from bigdl.dllib.nncontext import init_nncontext
  from bigdl.orca.tfpark import TFDataset, TFPredictor
  from bigdl.dllib.utils.common import *
  import numpy
  import sys
  import os
  from bigdl.dllib.feature.dataset import mnist
  from bigdl.dllib.utils.log4Error import invalidInputError
  from nets import lenet
label_desc: Use image node_id 1 for calling a global function with example usage: main(data_num) without return types