code: def infer(infer_program, image, logits, place, exe):
      print("--------------------inference-------------------")
  
      test_batch_size = 1
      test_reader = paddle.batch(
          reader.test(TEST_LIST, DATA_PATH), batch_size=test_batch_size
      )
      feeder = fluid.DataFeeder(place=place, feed_list=[image])
      fetch_list = [logits.name]
  
      label_res = {}
      for batch_id, data in enumerate(test_reader()):
          data_img = data[0][0]
          filename = data[0][1]
  
          result = exe.run(
              infer_program,
              fetch_list=fetch_list,
              feed=feeder.feed([data_img]),
          )
          # print(result)
          result = result[0][0]
          pred_label = np.argmax(result)
          print(
              "Test-{0}-score: {1}, class {2}, name={3}".format(
                  batch_id, result[pred_label], pred_label, filename
              )
          )
          label_res[filename] = pred_label
          sys.stdout.flush()
  
      return label_res
  
file_path: AdvBox/example/imagenet_example_cw.py
imports: from __future__ import print_function
  import sys
  import os
  import numpy
  import logging
  import paddle.fluid
  import paddle
  import models
  import reader
  import argparse
  import functools
  from utility import add_arguments, print_arguments, generation_image
  from adversarialbox.adversary import Adversary
  from adversarialbox.attacks.cw import CW_L2
  from adversarialbox.models.paddle import PaddleModel
label_desc: Use image node_id 1 for calling a global function with example usage: infer(infer_program, image, logits, place, exe) and returns: label_res