Multi-platform Inference

Overview

Models based on MindSpore training can be used for inference on different hardware platforms. This document introduces the inference process on each platform.

  1. Inference on the Ascend 910 AI processor

    MindSpore provides the model.eval() API for model validation. You only need to import the validation dataset. The processing method of the validation dataset is the same as that of the training dataset. For details about the complete code, see https://gitee.com/mindspore/mindspore/blob/r0.3/example/resnet50_cifar10/eval.py.

    res = model.eval(dataset)
    

    In addition, the model.predict () interface can be used for inference. For detailed usage, please refer to API description.

  2. Inference on the Ascend 310 AI processor

    1. Export the ONNX or GEIR model by referring to the Export GEIR Model and ONNX Model.

    2. For performing inference in the cloud environment, see the Ascend 910 training and Ascend 310 inference samples. For details about the bare-metal environment (compared with the cloud environment where the Ascend 310 AI processor is deployed locally), see the description document of the Ascend 310 AI processor software package.

  3. Inference on a GPU

    1. Export the ONNX model by referring to the Export GEIR Model and ONNX Model.

    2. Perform inference on the NVIDIA GPU by referring to TensorRT backend for ONNX.

On-Device Inference

The On-Device Inference is based on the MindSpore Predict. Please refer to On-Device Inference Tutorial for details.