@@ -61,7 +61,7 @@ Next, let's use MindSpore to solve the image classification task. The overall pr
...
@@ -61,7 +61,7 @@ Next, let's use MindSpore to solve the image classification task. The overall pr
5. Call the high-level `Model` API to train and save the model file.
5. Call the high-level `Model` API to train and save the model file.
6. Load the saved model for inference.
6. Load the saved model for inference.
> This example is for the hardware platform of the Ascend 910 AI processor. You can find the complete executable sample code at: <https://gitee.com/mindspore/docs/blob/master/tutorials/tutorial_code/resnet>.
> This example is for the hardware platform of the Ascend 910 AI processor. You can find the complete executable sample code at: <https://gitee.com/mindspore/docs/tree/master/tutorials/tutorial_code/resnet>.
The key parts of the task process code are explained below.
The key parts of the task process code are explained below.
@@ -88,7 +88,7 @@ Currently, MindSpore GPU and CPU supports SentimentNet network based on the long
...
@@ -88,7 +88,7 @@ Currently, MindSpore GPU and CPU supports SentimentNet network based on the long
Long short-term memory (LSTM) is an artificial recurrent neural network (RNN) architecture used for processing and predicting an important event with a long interval and delay in a time sequence. For details, refer to online documentation.
Long short-term memory (LSTM) is an artificial recurrent neural network (RNN) architecture used for processing and predicting an important event with a long interval and delay in a time sequence. For details, refer to online documentation.
3. After the model is obtained, use the validation dataset to check the accuracy of model.
3. After the model is obtained, use the validation dataset to check the accuracy of model.
> The current sample is for the Ascend 910 AI processor. You can find the complete executable sample code at:<https://gitee.com/mindspore/mindspore/blob/master/model_zoo/official/nlp/lstm>
> The current sample is for the Ascend 910 AI processor. You can find the complete executable sample code at:<https://gitee.com/mindspore/mindspore/tree/master/model_zoo/official/nlp/lstm>
> - `src/config.py`:some configurations on the network, including the batch size and number of training epochs.
> - `src/config.py`:some configurations on the network, including the batch size and number of training epochs.
> - `src/dataset.py`:dataset related definition,include MindRecord file convert and data-preprocess, etc.
> - `src/dataset.py`:dataset related definition,include MindRecord file convert and data-preprocess, etc.
> - `src/imdb.py`: the util class for parsing IMDB dataset.
> - `src/imdb.py`: the util class for parsing IMDB dataset.
@@ -38,7 +38,7 @@ This section takes a Square operator as an example to describe how to customize
...
@@ -38,7 +38,7 @@ This section takes a Square operator as an example to describe how to customize
The primitive of an operator is a subclass inherited from `PrimitiveWithInfer`. The type name of the subclass is the operator name.
The primitive of an operator is a subclass inherited from `PrimitiveWithInfer`. The type name of the subclass is the operator name.
The definition of the custom operator primitive is the same as that of the built-in operator primitive.
The definition of the custom operator primitive is the same as that of the built-in operator primitive.
- The attribute is defined by the input parameter of the constructor function `__init__`. The operator in this test case has no attribute. Therefore, `__init__` has only one input parameter. For details about test cases in which operators have attributes, see [custom add3](https://gitee.com/mindspore/mindspore/tree/master/tests/st/ops/custom_ops_tbe/cus_add3.py) in the MindSpore source code.
- The attribute is defined by the input parameter of the constructor function `__init__`. The operator in this test case has no attribute. Therefore, `__init__` has only one input parameter. For details about test cases in which operators have attributes, see [custom add3](https://gitee.com/mindspore/mindspore/blob/master/tests/st/ops/custom_ops_tbe/cus_add3.py) in the MindSpore source code.
- The input and output names are defined by the `init_prim_io_names` function.
- The input and output names are defined by the `init_prim_io_names` function.
- The shape inference method of the output tensor is defined in the `infer_shape` function, and the dtype inference method of the output tensor is defined in the `infer_dtype` function.
- The shape inference method of the output tensor is defined in the `infer_shape` function, and the dtype inference method of the output tensor is defined in the `infer_dtype` function.