code: def inference(cls, architecture, files, path, image_path):
      import numpy as np
  
      if cls.sanity_check(architecture):
          # refer to https://github.com/PaddlePaddle/Paddle/blob/develop/python/paddle/v2/tests/test_rnn_layer.py#L35
          reset_parser()
  
          # refer to https://github.com/PaddlePaddle/Paddle/issues/7403
          paddle.init(use_gpu=False, trainer_count=1)
  
          DATA_DIM = (
              3
              * paddle_extractor._image_size
              * paddle_extractor._image_size
          )  # Use 3 * 331 * 331 or 3 * 299 * 299 for Inception-ResNet-v2.
          CLASS_DIM = paddle_extractor.class_dim_map[architecture]
          image = paddle.layer.data(
              name="image", type=paddle.data_type.dense_vector(DATA_DIM)
          )
  
          if "resnet" in architecture:
              from mmdnn.conversion.examples.paddle.models import resnet
  
              depth = int(architecture.strip("resnet"))
              out = resnet.resnet_imagenet(
                  image, class_dim=CLASS_DIM, depth=depth
              )
          elif architecture == "vgg16":
              from mmdnn.conversion.examples.paddle.models import vgg
  
              out = vgg.vgg16(image, class_dim=CLASS_DIM)
          else:
              print("Not support for {} yet.", architecture)
              return None
  
          _, parameters_file = files
  
          with gzip.open(parameters_file, "r") as f:
              parameters = paddle.parameters.Parameters.from_tar(f)
  
          func = TestKit.preprocess_func["paddle"][architecture]
          img = func(image_path)
          img = np.transpose(img, [2, 0, 1])
          test_data = [(img.flatten(),)]
  
          predict = paddle.infer(
              output_layer=out, parameters=parameters, input=test_data
          )
          predict = np.squeeze(predict)
  
          return predict
  
      else:
          return None
  
file_path: MMdnn/mmdnn/conversion/examples/paddle/extractor.py
imports: from __future__ import absolute_import
  from mmdnn.conversion.examples.imagenet_test import TestKit
  from mmdnn.conversion.examples.extractor import base_extractor
  from mmdnn.conversion.common.utils import download_file
  import paddle.v2
  import gzip
  from paddle.trainer_config_helpers.config_parser_utils import reset_parser
label_desc: Use image node_id 3 for calling the paddle_extractor obj's underlying member method code with example usage: obj.inference(cls, architecture, files, path, image_path) and returns: predict, None, None