diff --git a/tutorials/source_en/use/saving_and_loading_model_parameters.md b/tutorials/source_en/use/saving_and_loading_model_parameters.md index 88d80140d166b2ab3309a71335de78899101b7b5..55299ab8062417017aead0113a6f82c5d750c7a3 100644 --- a/tutorials/source_en/use/saving_and_loading_model_parameters.md +++ b/tutorials/source_en/use/saving_and_loading_model_parameters.md @@ -149,7 +149,7 @@ param_dict = load_checkpoint("resnet50-2_32.ckpt") # load the parameter into net load_param_into_net(resnet, param_dict) input = np.random.uniform(0.0, 1.0, size = [32, 3, 224, 224]).astype(np.float32) -export(resnet, input, file_name = 'resnet50-2_32.pb', file_format = 'GEIR') +export(resnet, Tensor(input), file_name = 'resnet50-2_32.pb', file_format = 'GEIR') ``` Before using the `export` interface, you need to import` mindspore.train.serialization`. The `input` parameter is used to specify the input shape and data type of the exported model. diff --git a/tutorials/source_zh_cn/use/saving_and_loading_model_parameters.md b/tutorials/source_zh_cn/use/saving_and_loading_model_parameters.md index 0bdf8fa7f711904001848ef415fdb693ef694d58..3b04433b2dbf9ca2d8d7f6462fc95213be15d9ad 100644 --- a/tutorials/source_zh_cn/use/saving_and_loading_model_parameters.md +++ b/tutorials/source_zh_cn/use/saving_and_loading_model_parameters.md @@ -149,7 +149,7 @@ param_dict = load_checkpoint("resnet50-2_32.ckpt") # load the parameter into net load_param_into_net(resnet, param_dict) input = np.random.uniform(0.0, 1.0, size = [32, 3, 224, 224]).astype(np.float32) -export(resnet, input, file_name = 'resnet50-2_32.pb', file_format = 'GEIR') +export(resnet, Tensor(input), file_name = 'resnet50-2_32.pb', file_format = 'GEIR') ``` 使用`export`接口之前,需要先导入`mindspore.train.serialization`。 `input`用来指定导出模型的输入shape以及数据类型。