提交 0d474f28 编写于 作者: M mindspore-ci-bot 提交者: Gitee

!138 fix sample code issues

Merge pull request !138 from 于振华/master
...@@ -150,7 +150,7 @@ param_dict = load_checkpoint("resnet50-2_32.ckpt") ...@@ -150,7 +150,7 @@ param_dict = load_checkpoint("resnet50-2_32.ckpt")
# load the parameter into net # load the parameter into net
load_param_into_net(resnet, param_dict) load_param_into_net(resnet, param_dict)
input = np.random.uniform(0.0, 1.0, size = [32, 3, 224, 224]).astype(np.float32) 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`. 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. The `input` parameter is used to specify the input shape and data type of the exported model.
......
...@@ -151,7 +151,7 @@ param_dict = load_checkpoint("resnet50-2_32.ckpt") ...@@ -151,7 +151,7 @@ param_dict = load_checkpoint("resnet50-2_32.ckpt")
# load the parameter into net # load the parameter into net
load_param_into_net(resnet, param_dict) load_param_into_net(resnet, param_dict)
input = np.random.uniform(0.0, 1.0, size = [32, 3, 224, 224]).astype(np.float32) 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` 使用`export`接口之前,需要先导入`mindspore.train.serialization`
`input`用来指定导出模型的输入shape以及数据类型。 `input`用来指定导出模型的输入shape以及数据类型。
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册