@@ -9,6 +9,7 @@ Here is a list of all classes with links to the namespace documentation for each
| mindspore::lite | [ModelImpl](https://www.mindspore.cn/lite/docs/en/master/apicc/lite.html#modelimpl) | ModelImpl defines the implement class of Model in MindSpore Lite. |
| mindspore::lite | [PrimitiveC](https://www.mindspore.cn/lite/docs/en/master/apicc/lite.html#primitivec) | Primitive defines as prototype of operator. |
| mindspore::lite | [Model](https://www.mindspore.cn/lite/docs/en/master/apicc/lite.html#model) | Model defines model in MindSpore Lite for managing graph. |
| mindspore::lite | [ModelBuilder](https://www.mindspore.cn/lite/docs/en/master/apicc/lite.html#modelbuilder) | ModelBuilder is defined by MindSpore Lite. |
| mindspore::lite | [ModelBuilder](https://www.mindspore.cn/lite/docs/en/master/apicc/lite.html#modelbuilder) | ModelBuilder is defined to build the model. |
| mindspore::session | [LiteSession](https://www.mindspore.cn/lite/docs/en/master/apicc/session.html#litesession) | LiteSession defines session in MindSpore Lite for compiling Model and forwarding model. |
Constructor of MindSpore Lite Context using input value for parameters.
...
...
@@ -42,31 +49,31 @@ Destructor of MindSpore Lite Context.
```
float16_priority
```
```
A **bool** value. Defaults to **false**. Prior enable float16 inference.
```
device_ctx_{DT_CPU}
```
A **DeviceContext** struct.
A [**DeviceContext**](https://www.mindspore.cn/lite/docs/en/master/apicc/lite.html#devicecontext) struct defined at the bottom of the text. Using to specify the device.
```
thread_num_
```
```
An **int** value. Defaults to **2**. Thread number config for thread pool.
```
allocator
```
```
A **std::shared_ptr<Allocator>** pointer.
A **pointer** pointing to [**Allocator**](https://www.mindspore.cn/lite/docs/en/master/apicc/lite.html#allocator).
```
cpu_bind_mode_
```
```
A **CpuBindMode** enum variable. Defaults to **MID_CPU**.
A [**CpuBindMode**](https://www.mindspore.cn/lite/docs/en/master/apicc/lite.html#cpubindmode) enum variable. Defaults to **MID_CPU**.
## ModelImpl
ModelImpl defines the implement class of Model in MindSpore Lite.
...
...
@@ -98,7 +105,7 @@ Get MindSpore Lite Primitive by name.
- Parameters
- `name`: Define name of primitive to be returned.
- `name`: Define name of Primitive to be returned.
- Returns
...
...
@@ -134,6 +141,7 @@ Static method to create a Model pointer.
Pointer of MindSpore Lite Model.
**Public Attributes**
```
model_impl_
...
...
@@ -141,7 +149,7 @@ Static method to create a Model pointer.
The **pointer** of implement of model in MindSpore Lite. Defaults to **nullptr**.
## ModelBuilder
ModelBuilder is defined by MindSpore Lite.
ModelBuilder is defined to build the model.
**Constructors & Destructors**
```
...
...
@@ -161,17 +169,17 @@ Destructor of MindSpore Lite ModelBuilder.
Add primitive into model builder for model building.
Add Primitive into model builder for model building.
- Parameters
- `op`: Define the primitive to be added.
- `op`: Define the Primitive to be added.
- `inputs`: Define input edge of primitive to be added.
- `inputs`: A vector of [**OutEdge**](https://www.mindspore.cn/lite/docs/en/master/apicc/lite.html#outedge). Define input edge of Primitive to be added.
- Returns
ID of the added primitive.
ID of the added Primitive.
```
const schema::MetaGraph* GetMetaGraph() const
...
...
@@ -188,7 +196,11 @@ virtual Model *Construct()
Finish constructing the model.
## OutEdge
A **struct**. OutEdge defines the edge in the gragh.
**Attributes**
```
nodeId
```
...
...
@@ -205,55 +217,53 @@ An **enum** type. CpuBindMode defined for holding bind cpu strategy argument.
**Attributes**
```
MID_CPU = -1
```
```
Bind middle cpu first.
```
HIGHER_CPU = 1
```
```
Bind higher cpu first.
```
NO_BIND = 0
```
```
No bind.
## DeviceType
An **enum** type. DeviceType defined for holding user's preferred backend.
**Attributes**
```
DT_CPU = -1
```
```
CPU device type.
```
DT_GPU = 1
```
```
GPU device type.
```
DT_NPU = 0
```
```
NPU device type, not supported yet.
## DeviceContext
A **struct**. DeviceContext defined for holding DeviceType.
A **struct**. DeviceContext defined for holding DeviceType.
**Attributes**
```
type
```
A **DeviceType** variable. The device type.
```
A [**DeviceType**](https://www.mindspore.cn/lite/docs/en/master/apicc/lite.html#devicetype) variable. The device type.
LiteSession defines session in MindSpore Lite for compiling Model and forwarding model.
**Constructors & Destructors**
```
LiteSession()
```
Constructor of MindSpore Lite LiteSession using default value for parameters.
```
~LiteSession()
```
...
...
@@ -38,7 +41,7 @@ Compile MindSpore Lite model.
- Returns
STATUS as an error code of compiling graph, STATUS is defined in errorcode.h.
STATUS as an error code of compiling graph, STATUS is defined in [errorcode.h](https://gitee.com/mindspore/mindspore/blob/master/mindspore/lite/include/errorcode.h).
> Note: RunGraph should be called after CompileGraph.
- Parameters
- `before`: Define a call_back_function to be called before running each node.
- `before`: A [**KernelCallBack**](https://www.mindspore.cn/lite/docs/en/master/apicc/session.html#kernelcallback) function. Define a callback function to be called before running each node.
- `after`: Define a call_back_function called after running each node.
- `after`: A [**KernelCallBack**](https://www.mindspore.cn/lite/docs/en/master/apicc/session.html#kernelcallback) function. Define a callback function to be called after running each node.
- Returns
STATUS as an error code of running graph, STATUS is defined in errorcode.h.
STATUS as an error code of running graph, STATUS is defined in [errorcode.h](https://gitee.com/mindspore/mindspore/blob/master/mindspore/lite/include/errorcode.h).
STATUS as an error code of resize inputs, STATUS is defined in errorcode.h.
STATUS as an error code of resize inputs, STATUS is defined in [errorcode.h](https://gitee.com/mindspore/mindspore/blob/master/mindspore/lite/include/errorcode.h).
**Static Public Member Functions**
...
...
@@ -173,13 +175,20 @@ Static method to create a LiteSession pointer.
> Note: TypeId is defined in mindspore/mindspore/core/ir/dtype/type_id.h. Only number types in TypeId enum are suitable for MSTensor.
> Note: TypeId is defined in [mindspore/mindspore/core/ir/dtype/type_id.h](https://gitee.com/mindspore/mindspore/blob/master/mindspore/core/ir/dtype/type_id.h). Only number types in TypeId enum are suitable for MSTensor.
> Note: TypeId is defined in mindspore/mindspore/core/ir/dtype/type_id.h. Only number types in TypeId enum are suitable for MSTensor.
> Note: TypeId is defined in [mindspore/mindspore/core/ir/dtype/type_id.h](https://gitee.com/mindspore/mindspore/blob/master/mindspore/core/ir/dtype/type_id.h). Only number types in TypeId enum are suitable for MSTensor.
-[Obtaining Version String](#obtaining-version-string)
-[Example](#example-6)
<!-- /TOC -->
...
...
@@ -132,7 +132,7 @@ session->Resize(inputs);
### Compiling Graphs
Before graph execution, call the `CompileGraph` API of the `LiteSession` to compile graphs and further parse the Model instance loaded from the file, mainly for subgraph split and operator selection and scheduling. This process takes a long time. Therefore, it is recommended that `ListSession` achieve multiple executions with one creation and one compilation.
Before graph execution, call the `CompileGraph` API of the `LiteSession` to compile graphs and further parse the Model instance loaded from the file, mainly for subgraph split and operator selection and scheduling. This process takes a long time. Therefore, it is recommended that `LiteSession` achieve multiple executions with one creation and one compilation.