mindspore_lite.ModelExecutor

View Source On Gitee
class mindspore_lite.ModelExecutor(executor=None)[source]

The ModelExecutor class wraps multiple mindspore_lite models and implements their inference scheduling.

Parameters

executor (_c_lite_wrapper.ModelExecBind, optional) – ModelExecutor class wrapped with pybind11. Default: None.

get_inputs()[source]

Obtains all input Tensors of the ModelExecutor.

Returns

list[Tensor], the input Tensor list of the ModelExecutor.

get_outputs()[source]

" Obtains all output information Tensors of the ModelExecutor.

Returns

list[TensorMeta], the output TensorMeta list of the ModelExecutor.

predict(inputs, outputs=None)[source]

Inference ModelExecutor.

Parameters
  • inputs (list[Tensor]) – A list that includes all input Tensors in order.

  • outputs (list[Tensor], optional) – A list that includes all output Tensors in order, this tensor include output data buffer.

Returns

list[Tensor], the output Tensor list of the ModelExecutor.

Raises
  • TypeErrorinputs is not a list.

  • TypeErroroutputs is not a list.

  • TypeErrorinputs is a list, but the elements are not Tensor.

  • TypeErroroutputs is a list, but the elements are not Tensor.

  • RuntimeError – predict model failed.