code: def main(options, data_num):
      data_path = (
          "/tmp/mnist" if not options.data_path else options.data_path
      )
      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: analytics-zoo/pyzoo/zoo/examples/tensorflow/tfpark/tf_optimizer/evaluate.py
imports: from optparse import OptionParser
  import tensorflow
  from zoo import init_nncontext
  from zoo.tfpark import TFDataset, TFPredictor
  import numpy
  import sys
  from bigdl.dataset import mnist
  from nets import lenet
label_desc: Use image node_id 1 for calling a global function with example usage: main(options, data_num) without return types